Does a plugin works in all documents? or can I tell it to work just in
the ones I am interested on?
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner
-
MODX Staff
- 2,502 Posts
Typically you would check for a condition before running a plugin but you could check for the condition of a document id match then run the actions of your plugin but it will in fact run each time the System Event(s) occurs.
Pseudo code:
if (document id == 23){
do plugin actions;}
else
{do nothing ;}
The plugin will run at every instance of onDocFormSave (if that is the event selected) but will do nothing unless the condition of document id was 23.
You will obviously need to adjust that to use the real code and api call.
Cheers,
Jay
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
mmm... I thought to do it like that, the problem is that the documents where
I want my plugin to work are created by the user, so I do not have the ids of the
future docs...
is there a way to check for the children of a container document (the parent)?
What are the parameters for the plugin that can be added in the Configuration tab for?
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner
Thanks as always Mrhaw, we should name you the official librarian
of MODx...
Very helpful link but it does not solve all my challenge as I need
to pass the parent folder as an argument to the plugin and then
search for the children and put them on an array to make the decision
of applying the plugin... I will search in the API to see if there
is a function childrenOf or something similar...
thanks again...
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner
Yes Jason, thanks for the help...
I was reading on all these that seem to do similar stuff...
getDocumentChildren
getActiveChildren
getAllChildren
getChildIds
but what I need is getChildIds as you well helped me with...
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner