Your cart is empty!
Prepare Times
do_action_ref_array( 'vikrestaurants_prepare_take_away_times', array &$times, mixed $search )
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.
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.
*/
add_action('vikrestaurants_prepare_take_away_times', function(&$times, $search)
{
foreach ($times as &$shift)
{
foreach ($shift as &$slot)
{
$disable = true;
/**
* @todo fetch time slot status
*/
// assign new status
$slot->disable = $disable;
}
}
}, 10, 2); Changelog
| Version | Description |
|---|---|
| 1.5.5 | Removed $status argument. |
| 1.2 | Introduced. |
Last Update: 1 week ago
Helpful?