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. |
Last Update: 2021-10-08
Helpful?