We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    I think it would be really useful to have a CMP tutorial for a *really* simple CMP. As far as I know, the current tutorials involve heavy extJS use, grids that are editable and sortable, updating custom tables in the DB, etc. They provide a lot of useful information but are quite daunting for a person writing their first CMP.

    I'd like to see a simple tutorial for a CMP that launches a small utility script that might do something like check for Resources with empty aliases and display a report. An advanced section could add links to edit the offending docs with Quick Edit. If such a thing exists, I'm not aware of it.

    I think that would help a lot of people get off the ground with CMPs.
      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
      • 18373 ☆ A M B ☆
      • 3,141 Posts
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 3749
        • 24,544 Posts
        Yes, that's excellent. I hadn't seen it. It would be great if it included an example that did something useful. And I'd love to know how to put a link to a Manager page in the output -- e.g. to go to the Create/Edit Resource panel for a particular resource. Is there a method to get the action ID of a particular Manager page? I haven't been able to find one. Can we count on the current IDs not changing?

        Shouldn't the language strings be:

        $_lang['setting_mycmp'] = 'My CMP';
        $_lang['setting_mycmp.menu_desc'] = 'My custom manager page.';


        and shouldn't the lexicon key under "Creating the Menu Object" be mycmp?

        If I'm not misrembering, the '.menu' is optional. If I'm right, I think it's simpler to just use:

        mycmp
        mycmp_desc
        
        $_lang['setting_mycmp'] = 'My CMP';
        $_lang['setting_mycmp_desc'] = 'My custom manager page.';
        


        Under "Strict Naming Conventions" I think it would be clearer to put the examples on their own lines. I think there should also be an underscore after 'setting' in the second example and another one before 'desc' -- like so:

        The name of your System Setting must use a Lexicon entry that is named after the setting's key, prefixed with "setting_":
        
            setting_ + Key
        
        The Description must follow the same format and include a suffix of "_desc":
        
            setting_ + Key + _desc
          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
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The URL for editing a resource is index.php?a=30&id=<id of resource>, so you should be able to add such a link.
            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
            • 18373 ☆ A M B ☆
            • 3,141 Posts
            The menu item doesn't prepend setting_ or whatever like the system settings do, but indeed the menu object should have used the actual lexicon keys, corrected in the rtfm.

            The actions will *usually* have the same ID, and I haven't noticed it being different anywhere, but I personally wouldn't rely on that as it isn't hardcoded like in Evo. You can use
            $actionId = $modx->actions['resource/update']

            or in the manager javascript
            var actionId = MODx.actions['resource/update']

            to get the proper ID.

            Note that in 2.3 there are no more actions and instead the link would just be like..
            manager/index.php?a=resource/update&id=340
            or for 3PCs
            manager/index.php?a=update&namespace=mycmp

            The actions variables do still exist for backwards compatibility sakes (and any extras creating modActions in the build still create and can use them) but aren't used anymore by the core.
              Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

              Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • 3749
              • 24,544 Posts
              Duh. Of course. I was thinking of System Settings for some reason.

              $actionId = $modx->actions['resource/update']


              is exactly what I was looking for. Thanks. Is that documented somewhere? I didn't have any luck finding it.

              Any idea when 2.3 is due?
                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