public function onCreateTimelineParser(mixed $search, string $parser) : string

Fires while instantiating the object used to parse the availability timeline.


Description

This hook can be used to safely change the class instance responsible of generating the availability timeline.

In addition to returning the new class name, plugins must include all the needed resources.

The returned object must also inherit the VAPAvailabilityTimelineParser 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/timeline/parser.php

In case of no returned classes, the class matching the identifier defined by $parser argument will be used.


Parameters

$search

(VAPAvailabilitySearch)  The availability search handler, holding all the query details.

$parser

(string)  The default parser identifier.

Return Value

String. The classname that will be used to instantiate the timeline parser.


Example

The example provides the instantiation of the "Extended" timeline parser, located within the VikAppointments - E4J plugin.

/plugins/vikappointments/e4j/extended.php
/**
 * This hook can be used to safely change the class instance
 * responsible of generating the availability timeline.
 * In addition to returning the new class name, plugins must
 * include all the needed resources. The returned object must
 * also inherit VAPAvailabilityTimelineParser class.
 *
 * @param   mixed   $search     The search handler.
 * @param   string  $parser     The parser name.
 *
 * @return  string  The classname of the parser to use.
 */
public function onCreateTimelineParser($search, $parser)
{
    // load class handler
    require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'extended.php';
	
    // return instance name
    return 'VAPAvailabilityTimelineParserExtended';
}

Changelog

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