modX.addEventListener
Last updated Oct 14th, 2026 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn moremodX::addEventListener¶
Add a plugin to the eventMap within the current execution cycle.
Syntax¶
boolean addEventListener (string $event, integer $pluginId, [string $propertySetName = ''])
$event(string) Name of the event. required$pluginId(integer) Plugin identifier to add to the event. required$propertySetName(string) The name of property set bound to the plugin
Example¶
Add a Plugin with ID 12 to the Event OnChunkFormPrerender:
$modx->addEventListener('OnChunkFormPrerender', 12);
The event name is not validated, so a listener registered for a misspelled or non-existent event fails silently.
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn more










