Hi,
I’d like to write a little plugin that checks and possibly modifies the content of a ressource when it is saved in the Manager (cleaning up after TinyMCE

).
Until now I only wrote plugins that modified the output of a page via
<?php
if ('OnWebPagePrerender' == $modx->event->name) {
// Get a reference to the output
$output = &$modx->resource->_output;
// Modify the output
$output = doSomethingWithOutput($output);
}
return;
?>
which worked perfectly.
Now I tried something like this (the event OnBeforeDocFormSave is checked in the plugin, of course):
<?php
if ('OnBeforeDocFormSave' == $modx->event->name) {
// Get a reference to the content
$content = &$modx->resource->_content;
// Modify the content
$content = doSomethingWithContent($content);
}
return;
?>
But as it seems, the content can’t be referenced this way. Could anybody tell me how to do this correctly?
Cheers,
Jan