If I have a plugin firing on OnBeforeDocFormSave for example, then I have full access to the $resource object and all of its properties (e.g. $resource->pagetitle or $resource->getTVValue('my_tv') )...
But how can I trigger the MODX parser to parse out my own formatting string? Say I've got something like this:
$x = 'Hello [[*pagetitle]], this is my [[*email]]';
And let's say that in my plugin I want to render $x for each page and store it somewhere. Doing some simple str_replace would not work cleanly because the $resource object does not populate attributes corresponding to the names of the TVs. E.g. print_r($resource) returns attributes for tv1, tv2 etc. when their human readable names might be "city", "email", etc.
For Snippets, I could set a property in the default property set and check the box that parsed the items, but that does not appear to be working in the plugin: printing $scriptProperties will blank out all the placeholders if the preprocess is checked, or if it is not, I end up with the raw unparsed placeholders.
Any ideas of how I can parse out an arbitrary string with values from the resource?
[ed. note: Everettg_99 last edited this post 13 years, 11 months ago.]