Create Search
apply_filters( 'vikappointments_create_availability_search', string $classname )
Fires while instantiating the availability search implementor.
Description
This hook can be used to safely change the class instance responsible of handling the whole availability system.
In addition to return the new class name, plugins must include all the needed resources.
The returned object must also inherit the VAPAvailabilitySearch
class. Take a look at the file below to figure out all the abstract methods that should be implemented.
/wp-content/plugins/vikappointments/helpers/libraries/availability/search.php
In case of no returned classes, the default VAPAvailabilityImplementor
object will be used.
The hook will be called only once per page session.
Parameters
- $classname
-
(string) The classname that will be used to instantiate the availability handler.
Example
The example provides the instantiation of the "Extended" availability handler, located within the VikWP plugin.
/wp-content/plugins/vikwp/extended.php
/**
* This hook can be used to safely change the class instance
* responsible of handling the whole availability system.
* In addition to returning the new class name, plugins must
* include all the needed resources. The returned object must
* also inherit VAPAvailabilitySearch class.
*
* @param string $classname The classname of the handler.
*/
add_filter('vikappointments_create_availability_search', function($classname)
{
// load class handler
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'extended.php';
// return instance name
return 'VAPAvailabilitySearchExtended';
});
Changelog
Version | Description |
---|---|
1.2 | Introduced. |