Editing Files from the Manager's Top Menu

How to create Top Menu items in the Manager that let you edit files directly

Suppose you have some files on your MODX site that you edit often. I'm always hacking away at the main .CSS file, .htaccess, and sometimes a few JavaScript files. It's a pain to keep going to the Files tab, waiting for the File tree to render, finding your file, and clicking on it. Wouldn't it be nice to be able to get there directly from the Manager's Top Menu? It's actually very easy to set this up, and you don't have to write any code.

Creating the "My Files" Top Menu Item

  1. Go to System | Actions on the Manager's Top menu.
  2. On the right side, Right-click on the Top Menu folder and select "Create Menu."
  3. Put "My Files" (without the quotes) in the key field. Use a different name if you like.
  4. Add a description (optional).
  5. Select "No Action" in the Action dropdown.
  6. Click on the "Save" button.

The following steps will be repeated for each file you want to add:

  1. Go to the Files tab and click on a file you want to add to your menu. You should see the file's contents in the Create/Edit File panel. Using the mouse, highlight and copy (Ctrl-C) the parameters from the URL in your browser's address bar to the clipboard. Copy just the part from the first & to the end.
  2. Go back to System | Actions.
  3. Right-click on the "My Files" menu item you just created and select "Place Action Here."
  4. In the Action dropdown, select "core - system/file/edit". It should be on page 4 of the list.
  5. Paste the parameters you copied before (Ctrl-V) into the "Parameters" field.
  6. Click on the "Save" button.

Repeat the steps above for each file you want on your menu. That's all there is to it.

You can click-and-drag the "MyFiles" item to a different location in the Top Menu and you can reorganize the files under it by dragging them up or down in the tree.

You'll have to reload the Manager page before your Menu items will show up.

Making Them All Top Menu Items

If you have a small number of files to edit and you don't want to bother with a drop-down list, you can make each one a Top Menu item. Just combine the two sets of steps above. For each file:

  1. In Manager | Actions, Right-click on the Top Menu folder.
  2. Select "Create Menu."
  3. Enter a name and description.
  4. Select "core - system/file/edit" for the Action.
  5. Paste the parameters for your file in the "Parameters" field.
  6. Click on the "Save" button.

You can drag the menu items up or down to reorganize the Top Menu.


There may be some users on your site who shouldn't be able to edit the files (or see the menu items). Protecting the menu items is simple. You may have noticed the "Permissions" field when you created your menus. That field can contain a comma-separated list of permissions (or a single permission) a user must have in order to see the menu item. Adding the sources permission will restrict access to users who have the right to manage Media Sources. If you want to be more restrictive, you can use access_permissions. Only very high-level users should have that permission (it allows users to change their own security status — and yours!). You can use any permissions here that are listed in the Administrator Policy. You can also create a custom permission here (call it anything you like) and add it to the Administrator Policy template.

Important! If you mess with permissions, keep two things in mind. First, be careful typing them. If you misspell a permission, not only will it not work, you won't have that permission and you won't see the menu item in the menu *or in the tree*, so you won't be able to fix it except by going into the database in PhpMyAdmin. Second, make sure that you have the permission you enter *before* adding it or the menu item will disappear from the tree.

Comments (0)

Please login to comment.