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

    Can anyone point me in the right direction for developing plugins for Revo? I’d like to develop the directresize Revo plugin to a level similar to the Evo version. As it currently stands it needs a bit more work.

    What I’m struggling with at the moment is defining the plugin properties. I have "rtfm" and seen the entries on defining a default lexicon value in the plugin code using

    $modx->lexicon->load('directresize:default');


    I can follow that if I use the "setting_" prefix on a my properties e.g. "setting_directresize.prefix" then it will create a system setting under directresize called prefix.

    What I’d really like to do is have most of these settings listed under the properties tab for the plugin. Now I realise that I can do this manually via the manager gui to add properties.

    Is there a way I can add these properties to the plugin programatically? The aim being that if I package up the plugin can I define it such that anyone installing the plugin will get these property settings in the plugin properties tab rather than having to delve into the system settings?

    I’m struggling to understand the differences between settings under the system settings menu item and the properties tab in the plugin. Anything to help this beginner!

    My apologies if this has already been covered elsewhere, I couldn’t find the information so any links would be appreciated.

    Regards

    Adrian

      • 3749
      • 24,544 Posts
      You create and set the plugin’s default properties when creating the transport package.

      Take a look at the MyComponent (in the GetMyComponent package) and the tutorial for it at bobsguides.com. It has an example of creating default properties.
        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
        • 1892
        • 82 Posts
        Many thanks for the pointers - I’ll investigate further as I think I’m expecting a complex solution rather than the obvious one!

        I’ve been creating the parameters in the manager interface, presumably using packman, this will then pick up these parmeters in the build.

        As the plugin parameter list seems to be a database field in the plugin table am I right that it’s locked to the language I used to create the parameter name and description? Also to reorder the list of parameters I presume I have to manually edit the database entry?

        Regards

        Adrian
          • 3749
          • 24,544 Posts
          Generally, the parameters will appear in the order you create them. To change that, you’d need to delete some or all of them and recreate them. If you’re using MyComponent, though, you can just change the order in the source file.

          I’m afraid I don’t know what you mean by "tied to the language."

          Property descriptions should be language strings, if that helps.
            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
            • 1892
            • 82 Posts
            Many thanks for all your help it did help immensely.

            What I hadn’t twigged was how the lexicon field was used when defining the parameter names, hence why I thought the language was "locked". I was trying to find some way to program the plugin to load the lexicon details. What I hadn’t realised was that in the manager by defining the lexicon as "directresize:properties" was that the modx manager would automagically look for a properties.inc.php file in the directresize plugin lexicon directory.

            However I’ve managed to change the order of the properties without deleting or re-creating any of them. The properties are stored in the modx_site_plugins table. The properties are just a text field in JSON format(?). Anyway by shuffling the text fields around a bit and writing back to the database then I managed reorder the properties quite easily.

            So once again many thanks for your help, I feel as though I’m making progress now - just got to sort out how to create a suitable repository on github.

            Regards

            Adrian
              • 3749
              • 24,544 Posts
              My book, which hopefully will be out someday has a section on creating a GitHub repository. wink

              Actually, the GitHub help sections are pretty good.
                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