Part Two - The Basics

Plugins - Modify Core behavior


Insert your functionality into MODXRule #1 of MODX development is 'Never Modify Core Code'. Modifying core code immediately makes it very difficult to upgrade MODX, since your modifications will be lost. But very often you will need to change the core behavior of MODX at some point in order to provide the functionality that you need. So MODX provides "Events", points during its processing, where you can insert your own code to modify or expand on the normal behavior of MODX. Plugins, like snippets, consist of PHP code that will be run at the point in MODX processing where the event specified is evoked.

The default MODX events are listed in the 'system_eventnames' table; as of Revolution 2.3.2 there are 180 of them. Many of them are evoked during Manager actions, such as immediately before or immediately after displaying one of the Manager forms, or before or after saving one of the forms. Some are for use before, during and after user validation and login. And some are for adding or modifying the behavior of the parser. There's most likely an event for you to hook into for just about anything you will want to change or add to MODX behavior.


Susan Ottwell
December 2015