public function onCreateTimelineRenderer(mixed $timeline, string $renderer) : string

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


Description

This hook can be used to safely change the class instance responsible of rendering 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 VAPAvailabilityTimelineRenderer 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/renderer.php

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


Parameters

$timeline

(VAPAvailabilityTimeline)  The timeline wrapper.

$renderer

(string)  The default renderer identifier.

Return Value

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


Example

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

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

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-05 17:25
Helpful?
See Also: