On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I’m trying to trace exactly how the manager is generated. For example, on the Profile drop-down, there is a missing image. According to a DOM examination, it should be a png image that is, indeed, in the path indicated. But trying to find exactly where is that image set has defeated me. Does it get set in some javascript somewhere? In a Smarty template somewhere?
      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
    • The manager is generated through Ext2. That means most things are built in Javascript, or through JSON.

      For the things that build it, you might want to see:

      MODx.Layout - manager/templates/default/ui/modx.layout.js
      This file creates the structure of the layout, as well as loading the topbar and trees.


      MODx.toolbar.TopMenu - manager/templates/default/ui/modtopmenu.class.js (to be renamed eventually to modx.topmenu.js)
      This loads the Top Menu. However, most everything is loaded from JSON data, which merits explanation. The PHP file that pulls it is here:
      core/model/modx/processors/system/menu/getmenu.php
      Note that it is grabbing "modMenu" objects. These objects are fields stored in the DB (modx_menus), which has the following fields:

      • id - The ID of the menu object
      • parent - The menus are heirarchical, so each menu can have a parent.
      • action - The modAction to redirect to when clicked. Note that this is an object. This is explained below.
      • text - The i18n string index to the $modx->lexicon ($_lang) string that will display the menu item text
      • icon - The URL to the icon to use. Optional.
      • menuindex - The order of the menu in its parent. Menus can be reordered.
      • params - Any GET params that you want to pass when clicking on the menu.
      • handler - Any JS you want to run before the menu loads the page (an onclick event).

      Note that these menus (and actions) can be managed via the Tools -> Actions page. The Top Menu can be rearranged, modified, etc, all from the tree on that page.

      modAction
      modActions are abstract representations of controllers (manager/controllers/). The reason they are in the database is to allow connection between them and the top menu, as well as other menus in MODx. They also will allow 3rd party components (snippets/plugins/etc) to create their own submenus for MODx, and customize the manager without modifying core code. Their fields are:

      • id - the action’s ID
      • context_key - The context in which the action is in.
      • parent - modActions can have parents as well, keeping them organized.
      • controller - The actual file path (starting from manager/controllers, and will be postfixed with .php (will also first search for "NAME/index.php").
      • haslayout - Whether or not to load the header/footer for the page
      • assets - Any other files related to the controller (not currently in use in 097)

      Hope that helps, Susan.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
      • Eventually I’m sure it will penetrate, via osmosis or trickle-down or beating it in with a rubber mallet or something... thanks!
          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