Italian (Italy)
Knowledge Base  >  Vik Appointments  >  Hook  >  Export  >  Default Drivers  >  ICS  >  After Build Event

apply_filters( 'vikappointments_after_build_event_ics', string $rules, array $event, mixed $data, mixed $handler )

Fires before terminating a VEVENT block.


Description

Trigger hook to allow the plugins to include custom options within the current calendar event. Here it is possible to attach new rules.

It is possible to include new options by appending them to the $rules argument or by using the helper methods provided by $handler instance.

// append to return argument
$rules .= "X-VAP-CUSTOM:XYZ\n";
// append through the ICS handler
$handler->addLine('X-VAP-CUSTOM', 'XYZ');

Parameters

$rules

(string) The rules to append at the end of the ICS head.

$event

(array)  An associative array containing the data of the event.

$records

(JObject)  A registry holding the details of the row fetched from the database.

It is possible to use $data->get($key) to access the internal properties of the record.

$handler

(VAPOrderExportDriverIcs)  The instance used to export the records. Provides some helper methods to encode the ICS lines.


Example

/**
 * Trigger event to allow the plugins to include custom options within the
 * current calendar event.
 *
 * @param  string   $rules    The rules to include within the event body.
 * @param  mixed    &$event   The event data.
 * @param  JObject  $data     The row fetched from the database.
 * @param  mixed    $handler  The current handler instance.
 */
add_filter('vikappointments_after_build_event_ics', function($rules, $event, $data, $handler)
{
    // include a new custom rule in the form: [PROPERTY]:[VALUE]
    $handler->addLine('X-VAP-LAST-UPDATE', $handler->tsToCal('now'));

    // include a new custom rule in the form: [PROPERTY];[RULE]:[VALUE]
    $handler->addLine(['X-VAP-URL', 'VALUE=URI'], 'https://domain.com');

    // manually include a custom rule
    $rules .= "X-VAP-URL-SHORT;VALUE=URI:https://dmn.com\n";

    return $rules;
}, 10, 4);

Changelog

Version Description
1.2.0 The $data argument is now a registry instance.
1.1.8 Introduced.
Ultimo aggiornamento: 2021-10-08
Utile?
Potrebbe interessarti:

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.