Hello,
I am trying to figure out a way to do a couple things here:
1) When a resource is edited use a plugin to strip_tags from the resource content
2) I am using form customization to hide a category of template variables so a user can not view or edit them. However if someone was tricky enough they could post the variables on their own to change the value. I would like to create a plugin which I am guessing would be on the same hook as #1 to stop editing of those template variables.
With regards to #2 I know you can restrict category access based on usergroups for this however I still need to load these template variables so I can use them in the mgr for the UI so this is not possible. When restricted to Load only they still have the ability to edit them via the resource editing.
Any help is appreciated.
It seems that I could use OnBeforeDocFormSave and put a plugin their to strip the tags, however how do you go about accessing the variables being Posted.
It seems that you can not change or check to see if a Template Variable has been modified using this hook, am I right regarding this ?
IIRC, the resource fields are in the $scriptProperties array (in the ['data'] member).
Yes, you can check to see if a TV has been modified, but it's tricky.
This is from memory, but I think it's correct. Get the new TV value with $resource->getTVValue(), get the old TV value by getting the TV object with $modx->getObject() and using $tv->getValue() or by getting the modTemplateVarResource object directly and pulling the value from there (faster):
http://bobsguides.com/modx-object-quick-reference.html#modTemplateVarResource.
The whole process is surprisingly fast, even for multiple TVs.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
Hey Bob,
Ok I'll give it a shot, is there a way to return false or to stop the update process once I have determined if they have been changed or return true if they can proceed ?
Thanks again