We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    I'm having two major problems with plugins. Revo 2.2.10, OnParseDocument.

    1. According to the modparser.class.php file, line 226:
    $this->modx->invokeEvent('OnParseDocument', array('content' => &$content));

    How do I access this 'content' to manipulate the content at this point?

    2. Any time I try to return a value with the onParseDocument event in order to get a log message I get a delay then a white-page with a PHP out-of-memory error, so I presume it's going into some kind of loop. Is this a bug, or has something changed in the event processing code? All other events appear to work as expected.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 3749
      • 24,544 Posts
      Since $content is a reference variable, if you just modify the $content variable in your plugin, the content should change -- no need to return anything.

      I generally don't return anything in plugins where the return value of invokeEvent() is ignored. IOW, unless the call looks like this, the return variable isn't going to do anything:

      $someVariable = $this->modx->invokeEvent('OnParseDocument', array('content' => &$content));


      I've also seen some funkiness with static plugins, in case you're trying that (though I haven't tried any for a while).
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting