Skip to content

Instantly share code, notes, and snippets.

@splittingred
Created May 4, 2011 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save splittingred/955986 to your computer and use it in GitHub Desktop.
Save splittingred/955986 to your computer and use it in GitHub Desktop.
$event= $modx->newObject('modEvent');
$event->fromArray(array (
'name' => 'OnMyEvent',
'service' => 1,
'groupname' => 'MyGroup'
));
$event->save();
/* Then associate it with a plugin: */
$pluginEvent = $modx->newObject('modPluginEvent');
$pluginEvent->fromArray(array(
'pluginid' => $idOfMyPlugin,
'event' => $event->get('name'),
));
$pluginEvent->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment