-
- 1,145 Posts
Do a test and confirm.
But I see no reason saving a resource would/should meddle (unexpectedly/negatively) with its TV values.
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
-
- 46 Posts
Tested, and it seems to have no effect on TVs. I was hoping someone with deeper knowledge of xPDO would confirm. I found no specific documentation. Honestly I wouldn’t think so, either. Just wanted to confirm.
For context: I’ve worked with WordPress and if you save a post but do not submit all your custom fields simultaneously, then WordPress assumes your intention was to delete those custom fields, which it does. Hence my overly cautions approach with this!
discuss.answer
-
- 1,145 Posts
A resource and its native fields head to one table.
Saving a resource will never, by default, crisscross into another table to affect custom fields, of which fields TV is one.
You will need another script to "access" / connect to the appropriate TV table in order to revert/update TVs values attached to a resource (via template)
Getting and setting
https://docs.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/template-variables/accessing-template-variable-values-via-the-api
Awesome resource!
https://bobsguides.com/blog.html/2016/11/14/understanding-the-modtemplatevarresource-object/
Nice schema of things
https://github.com/modxcms/revolution/blob/2.x/core/model/schema/modx.mysql.schema.xml
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
-
- 24,544 Posts
$resource->save won't touch any TV values. You can include them in the fields when you call $modx->runProcessor('resource/update'), though it's a little tricky.
-
- 46 Posts
Thank you @BobRay and @donshakespeare! Exactly what I needed to know!