Your cart is empty!
Prepare Times
public function onPrepareTakeAwayTimes( array &$times, mixed $search ) : void
Fires after calculating the times availability.
Description
Plugins can use this hook to manipulate the available timeslots at runtime, in order to enhance the default restrictions and the functionalities.
NOTE: the timeslots can be enabled/disabled by toggling the related disable
property.
Parameters
- &$times
-
(array) An array of working shifts and the releated timeslots.
- $search
-
(VREAvailabilityTakeaway) The instance used to calculate the availability of the times.
Return Value
None.
Example
The example explains how to manipulate the timeslots.
/**
* Plugins can use this hook to manipulate the available timeslots
* at runtime, in order to enhance the default restrictions and the
* functionalities.
*
* @param array &$times An array of working shifts and the releated timeslots.
* @param self $search The availability search instance.
*
* @return void
*/
public function onPrepareTakeAwayTimes(&$times, $search)
{
foreach ($times as &$shift) {
foreach ($shift as &$slot) {
$disable = true;
/**
* @todo fetch time slot status
*/
// assign new status
$slot->disable = $disable;
}
}
}
Changelog
Version | Description |
---|---|
1.8.3 | Introduced. |
Last Update: 2023-12-29 14:15
Helpful?