English (United Kingdom)
Knowledge Base  >  Vik Appointments  >  Hooks  >  Calendar  >  Display Event

apply_filters_ref_array( 'vikappointments_display_calendar_rect', bool $status, array &$data, mixed $event )

Fires before displaying an event within the weekly/daily calendar.


Description

Trigger hook to let external plugins manipulate the text to display, the background color and additional data to introduce within the HTML rectangle.


Parameters

$status

(bool)  True on success, false otherwise.

&$data

(array)  An associative array of display data.

  • id - an array of appointments;
  • employee - an array of employees (assigned to the appointments);
  • service - an array of services (assigned to the appointments);
  • color - the (HEX) background color of the event to display (without #);
  • label - the HTML to display as label within the event.
$event

(CalendarRect)  The object handling a list of events.


Example

/**
 * Trigger hook to let external plugins manipulate the text to display,
 * the background color and additional data to introduce within the HTML rect.
 *
 * @param  boolean  $status  True on success, false otherwise.
 * @param  array    &$data   An associative array of display data.
 * @param  self     $rect    The object handling all the events.
 */
add_filter('vikappointments_display_calendar_rect', function($status, &$data, $event)
{
    /**
     * @todo it is possible to manipulate here the data array
     */

    return true;
}, 10, 3);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-10-06
Helpful?