This project is read-only.

Add submenu items to Orchard CMS Admin Menu without using code

Topics: Administration, General
Jul 6, 2015 at 11:40 AM

Is it possible to add submenu items to Orchard CMS Admin Menu without writing code?

For example, I defined two content (Article Jerry, Article Peter) and I was writing some code so that Article Jerry and Article Peter (both have article list and new article subMneu) can show up under the admin Menu.

Now I need to create another content Type (say Article Janine) and I got bit bored on keep on coding (as orchard is a cms system and I think more things should be done via config other than coding).
I found that that I can create new content Type using the admin Menu, but seems can't create a submenu on the admin menu without creating an implementation of INavigationProvider.

Is there a way that I can avoid coding and do it via the admin UI (maybe install some plugin or module for example)?
Jul 7, 2015 at 11:27 PM
You could create Lists to which you can add your content items. These Lists can be configured to appear on the admin menu item.
Alternatively, you could write a custom content part (e.g. AdminMenuPart) and implement a single INavigationProvider that adds all content items to the admin menu that have this part attached (and configured).
Jul 7, 2015 at 11:50 PM
I know how to write custom content part and implement INavigationProvider. But that means coding.

What I really want is non-developers to be able to create submenu items. You mentioned You could create Lists to which you can add your content items. This sounds very interesting. Do you know where can I find some documents on how to do this?
Jul 8, 2015 at 9:46 AM
Sure, but you would only write this content part once, and then non-developers can add any content item to the admin menu without coding.

I'm afraid there's no documentation on the Lists module, but it is very simple to use:
  1. Enable the Lists feature.
  2. Create a new List (which is a content type, so you'll see it as part of the admin menu in the 'New' section).
  3. When creating the list, you'll see it has a setting to display the list on the admin menu. You can provide the menu item text as well as position.
Hope this helps.
Jul 8, 2015 at 5:11 PM
Hi sfmskywalker,

Thanks very much for your continuous education.

Now I have a List setup on my admin menu. But when I try to choose items, I can filter by content type and have to choose ones that already there.

Is it possible that I can just choose a content type for items in the list. Then every time a new content is created under that type, it will be automatically displayed under that list.

Many Thanks
Jul 8, 2015 at 6:38 PM
My pleasure.

The easiest way to get your items into your list automatically is by creating your items through the list itself. To do so, follow these steps once:
  1. Configure your content types that you want to be able to add to the list by attaching the ContainablePart.
  2. Also configure your content types to be not "creatable".
  3. Edit your list properties to only allow content items of a specific type (the types mentioned in step 1).
  4. Now you'll be able to create new content items through the list (no longer via the New section). Doing this will cause your items to be added to the list automatically.