Handlers
The MODX events the package subscribes to, and what the framework does on each. Your own class with the same name runs after the framework one — see Events.
Request lifecycle
| Event | What the framework does |
|---|---|
OnMODXInit | Nothing yet. Registered with priority: 1000 so the component boots before other plugins that may depend on it. |
OnHandleRequest | Aliases modUser and modUserProfile to their MODX\Revolution\ counterparts, starts the session, and lets routing take over the request. |
OnWebPageInit | Front-end setup for the requested page. |
OnCacheUpdate | Clears the route cache, the Fenom view cache, the component cache and the menu cache, and drops $_SESSION['pageblocks']. Runs whenever MODX clears its cache. |
Clearing the MODX cache clears ours
OnCacheUpdate means the manager's "Clear cache" button already covers PageBlocks — routes, compiled templates and cached lists. You rarely need to clear anything by hand.
Resource form
| Event | What the framework does |
|---|---|
OnDocFormPrerender | On an existing resource, loads the component's manager scripts. Skipped in new mode. |
OnDocFormRender | Renders the resource's section fields into the form. Skipped in new mode. |
OnBeforeDocFormSave | Collects the section field values from the submitted form and writes them into the resource. |
OnResourceDuplicate | Copies the resource's PageBlocks content to the copy: blocks, their nested tables and galleries, and rows attached to the resource's section fields. Custom field values ride along inside properties, which MODX copies itself. |
User form
| Event | What the framework does |
|---|---|
OnUserFormPrerender | Loads manager scripts for an existing user. Skipped in new mode. |
OnUserFormRender | Renders the user's section fields into the form. |
OnUserSave | Writes custom user fields into modx_user_attributes.extended. Runs after the core processor on purpose — otherwise the processor would overwrite extended. |
OnUserDuplicate | The user counterpart of OnResourceDuplicate. Accepts several spellings of the processor's parameters, because they differ between MODX builds. |
OnUserRemove | No framework handler. Registered so a site can hook it from core/App/Events/OnUserRemove.php. |
Manager
| Event | What the framework does |
|---|---|
OnManagerPageBeforeRender | Loads the base scripts, the data scripts and the rich text editor on every manager page. |
OnSiteSettingsRender | Adds modx.combo.js to the system settings page. |
Not subscribed
OnLoadWebDocument and OnPageNotFound are present in the package definition but commented out. If you need them, add them to the plugin's event list in the manager and put a class in core/App/Events/.
Where the code is
Framework handlers live in core/components/pageblocks/src/Events/, one file per event. They are short and readable — when this page is not enough, the class itself usually is.