Jump to main content Jump to doc navigation

modX::runProcessor

Loads and runs a specific processor. The method takes 3 arguments:

  • action - The action to take (the processor to run), this is the path to the processor (without the file extension) realtive to the core/model/modx/processors/ directory (by default).
  • scriptProperties - An array of properties passed to the processor.
  • options - An array of options passed to the processor.
    • processors_path - If specified, will override the default MODX processors path (core/model/modx/processors/) where MODX is looking for the processor. This is helpful if you write your own custom processors and place them for example in your core/components/yourextra/processors/ directory.

This method replaces $modX->executeProcessor() prior to version 2.1

Syntax

API Doc: modX::runProcessor()

mixed runProcessor(string $action = '', array $scriptProperties = array(), array $options = array())

Example

Run the ResourceGroup create processor:

// create new resource group programatically
$response = $modx->runProcessor('security/resourcegroup/create', array(
    'name' => 'Test', // the name of the new resource group
    'access_contexts' => 'mgr,web', // the context(s) the new resource group is restricting access in
    'access_admin' => 1, // adds access to this resource group for Administrators
    'access_parallel' => 1, // creates a new user group "Test" parallel to the resource group
    'access_usergroups' => 'Editors', // adds access to the new resource group for the user group "Editors"
));

See Also