This handler fires immediately after an item is created or updated that originates from a synced source. Or, if the original event has not been changed, the handler is called with mode=unchanged. (At present, $type may only be ‘events’.) An example module is below.
Parameter | Description |
---|---|
$type | currently only works for $type = “events” |
$subscription_id | id of the linked calendar |
$event_id | id of the event just created/updated |
$mode | “create”, “update”, or “unchanged” |
$item | array of the original feed item values |
<?php
$_LW->REGISTERED_APPS['my_app']=[
'title'=>'My App',
'handlers'=>['onAfterSync'],
];
class LiveWhaleApplicationMyApp {
// perform additional form validations
public function onAfterSync($type, $subscription_id, $event_id, $mode, $item) {
global $_LW;
if ($type == 'events') {
// use the $subscription_id to only apply this to a certain linked calendar
if ($subscription_id === 17) {
// check $item/$mode and take any desired actions
}
}
}
}
?>