Jump to main content Jump to doc navigation

What are System Events?

System Events are points in the MODX code where Plugins run. MODX fires them throughout its code, so a Plugin can hook into any step without editing the core.

The Model of a System Event

The system events table is {table_prefix}_system_eventnames with these fields:

Field Description
id Unique ID of the event.
name Event name, referenced in code via modX.invokeEvent.
service Type of system event.
groupname Used by user interfaces to filter, group, and sort events. The MODX model does not use it.

Service Types

The service field holds a number that identifies the type of event:

Value Service
1 Parser Service Events
2 Manager Access Events
3 Web Access Service Events
4 Cache Service Events
5 Template Service Events
6 User Defined Events

Service 3 does not fire in the mgr Context; Service 2 fires only there.

Available Events

The events below are grouped by the groupname shown in the Manager’s event list. For the full list of registered events, see transport.core.events.php.

Categories

Chunks

Contexts

Internationalization

Media Sources

Package Manager

Plugin Events

Plugins

Property Sets

Resources

RichText Editor

Security

Settings

Snippets

System

Template Variables

Templates

User Groups

User Profiles

Users

Custom Events

No GUI exists for custom events yet — create them through the API. Events have these attributes:

Attribute Description
name The unique event name.
service A loose grouping of events by area. Services 1, 2, 4, 5 and 6 load inside the Manager; services 1, 3, 4, 5 and 6 load outside it (see getEventMap()).
groupname Groups the events visually in the MODX Manager, where it appears as a Plugin tab.

Create an event through the MODX API:

$Event = $modx->newObject('modEvent');
$Event->set('name', 'OnMyCustomEvent');
$Event->set('service',1);
$Event->set('groupname', 'Custom');

Fire the event by name:

$modx->invokeEvent('OnMyCustomEvent', $options);

Then register a Plugin for the event. It receives the options passed to invokeEvent().

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

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • Alex
  • A. Moreno
  • Chris Fickling
  • Stéphane Jäggi
  • Murray Wood
  • Anton Tarasov
  • JT Skaggs
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • YJ
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$194 per month—let's make that $500!

Learn more