$modx->getRequest();
$modx->request->sanitizeRequest();
$modx->request->handleRequest(array('processors_path' => $docmanager_processors,
'location' => 'processors'));
$modx->initialize('connector');$modx->initialize('mgr');The context being executed should never be switched in this. You are misunderstanding the use of contexts here. You can loaded contextual data manually if you need to work with it, but getChildIds() is a context specific function and not meant to be used in management interfaces like you are constructing. You can load specific context data without switching contexts (check out makeUrl() now to see the kinds of challenges managing data from multiple contexts is going to present to the component you’ve chosen to work on). But it’s absolutely imperative that you do not switch to the contexts of the documents you are managing; that would be bypassing your security into the mgr context.
Just thinking aloud here, no matter what context the connector is called in,’mgr’ sounds good if we are in the manager of course, until my back end processor code is executed I’ll never know what contexts I’m going to need, because this code examines the input parameters, doc id’s in my case, only then will I ever know which context to switch to/load/manipulate. So, which context we start in is not that important, as long as it gets the processor code executed.
Just to clarify further, I’m entering this docid ’10**’, which means ’apply the template change to all children, immediate or otherwise’, that’s why I use the getchildid’s API to first get the children which only works if you are in the context the start doc is in.
What I am saying is you can use it in any front-end context script. It’s just not meant as a content management function. It’s purpose is to get faster access to that data in front-end scripts, period.
How could one use the $modx->getChildIds then in a module/plugin (or any custom context)?
You should be just able to include the connectors/index.php file to instantiate the correct context.
I can’t instantiate a modx object in the right context because at the time(when the connector fires) I don’t know what context it will need until I’ve checked the params, this seems to me to be wrong, but not fatal. I can assume ’mgr’ but this doesn’t work(see below).
If I’m understanding you as you’re saying in your custom form there’s a field with name="action", then you’re doing it wrong - ’action’ as a REQUEST param is reserved in MODx Revolution. You need to change that REQUEST param to another name.
Sorry to be blunt here but please explain how I get to execute my back end processor code, then get to see any context I like. Don’t forget that my ’action’ for the processor is the name of the file, not a number, so modmangerresponse will always fail here.
You should be just able to include the connectors/index.php file to instantiate the correct context.
$_REQUEST[’action’],which is how MODx knows what file to reach.won’t work in the modmangerresponse class as it needs an integer so it can map this to an action, not a file to include.