We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45613
    • 45 Posts
    Is there a list of Revo 2.2 class based processors? And available options?
    I got some good information from Mark Hamstra is his post about class-based processors.
    There is also some information in the doodles tutorial part 2 about creating a CMP.

    But I can't seem to find a list of Processors and how to use them.

    In looking at the "Creating a custom TV Type in MODX 2.2", it looks like the Render is a processor too?
    at least it seems to have a similar structure.

    Is there a list of other Classes like modTemplateVar? modTemplate? that at setup like processors and can be used the same way?

    I am having trouble finding good examples on how to use this. Even some of the extras like Gallery which works with 2.2 does not have the galleryitem TV input setup to use the 2.2 process.

    Any suggestions on where to find a good explanation of how this is setup and works and and where to find a list of these class based processors and renderers?

    Thanks in advance for any pointers.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Well, you can find the processors in core/model/modx/processors. Other than that, and the API documentation (based on the comments in the code), I'm not aware of any other documentation than what you've mentioned.

      To create an element, it follows a chain of extended classes - take creating templates as an example:

      core/model/modx/processors/element/template/create.class.php: modTemplateCreateProcessor extends modElementCreateProcessor

      core/model/modx/processor/element/create.class.php: modElementCreateProcessor extends modObjectCreateProcessor

      core/model/modx/modprocessor.class.php: modObjectCreateProcessor extends modObjectProcessor

      core/model/modx/modprocessor.class.php: modObjectProcessor extends modProcessor

      core/model/modx/modprocessor.class.php: modProcessor

      Creating any element, or anything else for that matter, would follow the pattern in BobRay's example of creating a chunk. Specify the object you're creating (modChunk, modResource, modUser...), the properties you want to assign it, then run the processor.

      modResource does allow you to use other object types like modStaticResource, but internally it will get reduced to modResource, and the properties array will specify if it's a static resource or not, along with the path to its file. This would be useful if creating a static resource automatically when uploading a .pdf file using the OnFileManagerUpload event.
        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
        Sometimes you have to look at the processor code to see what it's expecting. The resource/create and resource/update processors will accept TVs (in a somewhat weird format), for example.

        In most cases though, it's just a matter of creating an associative array of fields and calling the processor like this:

        $fields = array(
            'pagetitle' => 'MyPage',
            'alias' => 'my-page',
            'published' => 'true',
            'content' => '<p>Some content.</p>',
        );
        $modx->runProccessor('resource/create', $fields);


        The processor 'name' (the first argument) is really the path to the processor under the processors directory.

        For most processors, very few fields are actually required.

        There's a list of the object fields here: http://bobsguides.com/modx-object-quick-reference.html
          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
          • 45613
          • 45 Posts
          Thanks Susan and Bob. This gives me more places to look.

          Thanks again.