Italian (Italy)
Knowledge Base  >  Vik Restaurants  >  Hooks  >  Take-Away  >  Prepare Times

apply_filters_ref_array( 'vikrestaurants_prepare_take_away_times', bool $status, 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

$status

(bool)  True on success, false otherwise.

&$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  bool   $status  True on success, false otherwise.
 * @param  array  &$times  An array of working shifts and the releated timeslots.
 * @param  self   $search  The availability search instance.
 */
add_filter('vikrestaurants_prepare_take_away_times', function($status, &$times, $search)
{
    foreach ($times as &$shift)
    {
        foreach ($shift as &$slot)
        {
            $disable = true;
            /**
             * @todo fetch time slot status
             */

            // assign new status
            $slot->disable = $disable;
        }
    }

    return $status;
}, 10, 3);

Changelog

Version Description
1.2 Introduced.
Ultimo aggiornamento: 2021-01-26
Utile?

Questo sito web utilizza i cookie

Questo sito web utilizza cookie e tecnologie simili. Alcune di queste tecnologie sono necessarie per il corretto funzionamento del sito web (essenziali). Altre tecnologie sono utilizzate per valutare il comportamento degli utenti (analisi), per integrare media esterni o per scopi pubblicitari. Se l'utente accetta, queste tecnologie vengono attivate. I dettagli sono riportati nella Privacy Policy. Da questa stessa pagina è inoltre possibile aggiornare/revocare il consenso. Se non si fornisce il consenso, verranno attivati solo i cookie con funzioni essenziali.

Sul nostro sito web utilizziamo tecnologie provenienti dagli Stati Uniti. Pertanto, se acconsentite, acconsentite anche al trasferimento dei vostri dati negli Stati Uniti. Desideriamo sottolineare che gli Stati Uniti non hanno un livello di protezione dei dati paragonabile a quello dell'Unione Europea e che qualsiasi azienda statunitense può essere obbligata dalle autorità statali a consegnare i vostri dati senza che voi abbiate alcuno strumento efficace di protezione legale contro questo.