public function onCreateAvailabilitySearch() : string

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.

/components/com_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.


Return Value

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 VikAppointments - E4J plugin.

/plugins/vikappointments/e4j/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.
 *
 * @return  string  The classname of the handler.
 */
public function onCreateAvailabilitySearch()
{
    // load class handler
    require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'extended.php';
	
    // return instance name
    return 'VAPAvailabilitySearchExtended';
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-05 17:22
Helpful?