We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14915
    • 43 Posts
    Hello,

    I am using Modx Revolution, and I’d like to customize the create and update snippet forms in the Manager.
    I’d like to embed BeSpin ( https://bespin.mozillalabs.com/docs/embedding/index.html ) into the snippet textarea.

    I looked at these files:
    manager/controllers/default/element/snippet/
    create.php
    update.php

    Adding a custom script tag, and a link tag to the head section seems easy enough. I just need to create a plugin that listens for the "OnSnipFormPrerender" event, and calls $modx->regClientStartupScript and $modx->regClientStartupHTMLBlock in both of these files.

    However, I’m trying to figure out how to add a custom class and options attribute to the snippet text area.

    It currently looks like this:

    <textarea name="snippet" id="modx-snippet-snippet" autocomplete="off" style="width: 95%; height: 394px;" class="x-form-textarea x-form-field" title=""></textarea>
    


    And I want to make it look like this:

    <textarea name="snippet" id="modx-snippet-snippet" autocomplete="off" style="width: 95%; height: 394px;" class="x-form-textarea x-form-field bespin" title="" data-bespinoptions='{ "stealFocus":true, "syntax": "php" }'></textarea>
    


    Which code do I edit to make this happen?

    Thanks!