OnManagerPageBeforeRender
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
$186 per month—let's make that $500!
Learn moreEvent: OnManagerPageBeforeRender¶
Fires in the manager controller before content is processed.
- Service: 2 - Manager Access Events
- Group: System
Event Parameters¶
| Name | Description |
|---|---|
| controller | The current manager page controller. |
Remarks¶
| Previous event | OnBeforeManagerPageInit |
|---|---|
| Next event | OnManagerPageAfterRender |
| File | core/src/Revolution/modManagerController.php |
| Class | abstract class modManagerController |
| Method | public function render() |
Example¶
Print the configuration of the controller being rendered:
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnManagerPageBeforeRender':
// which controller is loading
print_r($scriptProperties['controller']->config);
print_r($scriptProperties['controller']->scriptProperties);
break;
}
Block editing a Resource whose ID is missing from the allow_to_update option:
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnManagerPageBeforeRender':
$controller = $scriptProperties['controller'];
if ($controller->config['controller'] !== 'resource/update') {
break;
}
$allow_to_update = $modx->getOption('allow_to_update');
if (empty($allow_to_update)) {
break;
}
if (!is_array($allow_to_update)) {
$allow_to_update = array_map('trim', explode(',', $allow_to_update));
}
if (!in_array($controller->scriptProperties['id'], $allow_to_update)) {
$controller->failure('Access is denied');
}
break;
}
Add a JavaScript file to manager pages:
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnManagerPageBeforeRender':
$modx->controller->addJavascript('url/file.js');
break;
}
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
$186 per month—let's make that $500!
Learn more










