English (United Kingdom)

apply_filters( 'vikappointments_create_timeline_parser', string $classname, mixed $search, string $parser )

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.

/wp-content/plugins/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

$classname

(string)  The classname that will be used to instantiate the timeline parser.

$search

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

$parser

(string)  The default parser identifier.


Example

The example provides the instantiation of the "Extended" timeline parser, located within the VikWP plugin.

/wp-content/plugins/vikwp/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  string  $classname  The classname of the parser to use.
 * @param  mixed   $search     The search handler.
 * @param  string  $parser     The parser name.
 */
add_filter('vikappointments_create_timeline_parser', function($classname, $search, $parser)
{
    // load class handler
    require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'extended.php';
	
    // return instance name
    return 'VAPAvailabilityTimelineParserExtended';
}, 10, 3);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-08-25
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information