Your cart is empty!
Before Fetch Data
public function onBeforeFetchCalendarData(array &$options) : void
Fires before fetching the calendar data in the front-end.
Description
Trigger hook before fetching the data needed to display a calendar in the front-end.
Useful, in example, to switch the calendar layout at runtime by altering the related array attribute.
Parameters
- &$options
-
(array) An array of search options.
id_ser
- the ID of the selected service;id_emp
- the ID of the selected employee;layout
- the type of layout to use (weekly or monthly).
Return Value
None.
Example
The example below uses a different calendar layout for the services that belongs to the group with ID equals to 1.
/**
* Trigger hook before fetching the data needed to display a calendar.
* Useful, in example, to switch the calendar layout at runtime by altering
* the related array attribute.
*
* @param array &$options An array of search options.
*
* @return void
*/
public function onBeforeFetchCalendarData(&$options)
{
// fetch service data
$service = JModelVAP::getInstance('service')->getItem($options['id_ser']);
if ($service->id_group == 1)
{
// use weekly calendar for services under group #1
$options['layout'] = 'weekly';
}
else
{
// otherwise fallback to monthly calendar
$options['layout'] = 'monthly';
}
}
Changelog
Version | Description |
---|---|
1.7 | Introduced. |
Last Update: 2021-10-06 16:09
Helpful?