public function onAfterBuildEventICS(array $event, mixed $data, mixed $handler) : string

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 returning them or by using the helper methods provided by $handler instance.

// append through the ICS handler
$handler->addLine('X-VAP-CUSTOM', 'XYZ');
// append as return value
return "X-VAP-CUSTOM:XYZ\n";

Parameters

$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.

Return Value

String. The rules to append at the end of the ICS head.


Example

/**
 * Trigger event to allow the plugins to include custom options within the
 * current calendar event.
 *
 * @param   mixed    &$event   The event data.
 * @param   JObject  $data     The row fetched from the database.
 * @param   mixed    $handler  The current handler instance.
 *
 * @return  string   The rules to include within the event body.
 */
public function onAfterBuildEventICS($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
    return "X-VAP-URL-SHORT;VALUE=URI:https://dmn.com\n";
}

Changelog

VersionDescription
1.7.0 The $data argument is now a registry instance.
1.6.6 Introduced.
Last Update: 2021-10-08 10:21
Helpful?