-
-
Notifications
You must be signed in to change notification settings - Fork 532
Open
Labels
featureRequest about implementing a brand new function or possibility.Request about implementing a brand new function or possibility.
Description
Summary
At the moment, all plugins triggered by events must be registered through the site manager. When working with file-based elements under Git, this adds certain limitations — for example, I need to manually create the same basic plugins in the manager on every site.
Why it is needed
It would be very useful to have a file-based event mechanism. For instance, if a file like elements/events/OnMODXInit.php exists, its code would automatically run when the corresponding event is fired. If the file does not exist, the event is simply skipped.
Suggested solution
- Allow events to check for corresponding files under a configurable path (e.g.
elements/events/{EventName}.php). - If the file exists, execute it.
- If not, do nothing.
Benefits
- Simplifies Git-based workflows.
- Removes the need to re-create the same plugins in the manager across multiple environments.
- Keeps project logic self-contained in files.
Example
// elements/events/OnMODXInit.php
<?php
$modx->log(modX::LOG_LEVEL_INFO, 'Custom bootstrap logic executed.');Metadata
Metadata
Assignees
Labels
featureRequest about implementing a brand new function or possibility.Request about implementing a brand new function or possibility.