Improve The Drupal 8 Admin Menu for Content Creators

Improve The Drupal 8 Admin Menu for Content Creators

The Drupal admin interface needs to keep a lot of people happy. The admin interface is often used by everyone from very experienced users to complete beginners.

One of our members asked if it was possible to create a custom menu for their content creators. They wanted one single place for Drupal beginners to find all the links they needed.

In this tutorial, we’ll show you how to do that and also create a faster, more usable admin menu.

Step #1. Publish the menu for content creators

Now we need to add a custom menu. Go to:

  • Go to Structure > Menus > Add Menu.

I added a menu called OSTraining Menu. It would be best to make the menu name as short as possible. If the user’s browser window is too small, the custom menus do not display.

Next, we need to add it to the menu bar. Go to:

  • Go to Configuration > Toolbar Menu.
  • Enable you menu, which in my example is “OSTraining Menu”.
  • Click “Save configuration”.

Configuration for the Toolbar Menu module

Now we have our custom menu showing in the admin menu, as in the image below:

A custom menu in the Drupal 8 admin toolbar

Step #2. Create the menu links

Currently we have an empty menu, so let’s add some links for our users.

  • Go to People > Roles > Add
  • Create the “Role”. In this example, I’m creating a “OSTraining Members” role.

Adding a new Drupal 8 role

Lets add create article to the menu so you can get an idea how it works. Go to:

  • Structure > Menus.
  • Next to OSTraining Menu, select “Edit menu”.
  • Add link

All the links added here will be sub Menus of our custom menu block. The image below shows a link that will allow members to add an article:

Add a new Drupal 8 article

You will need to make sure the permissions are correct, so that your users can access the custom menu. Go to:

  • People > Permissions.

Figuring out which permissions you need can often be troublesome, so to save time I am going to list the permissions you will require. Check the following permissions :

  • Toolbar (grants access to the admin toolbar)
  • Toolbar Menu (grants access to the custom menus)
  • View the OSTraining Menu menu in the toolbar (grants access to the custom menu we created)
  • Article: Create new content (This will allow the user to make articles)

Once you’ve finished this process, your users will see the “OSTraining Menu” and then the “Add article” link underneath. You can use the combination of custom menus and permissions to configure entire groups of users to perform specific roles for the website.

The complete sub menu

Author

0 0 votes
Article Rating
Subscribe
Notify of
guest

8 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
pepperstreet
8 years ago

Thanks for the article and solution.

(Unfortunately, something like this needs 3 extra modules ;( )

Dane Rossenrode
Dane Rossenrode
8 years ago

I actually wanted the same thing, but I was happy to code it myself instead of using several modules.
I started by implementing hook_toolbar_alter(), and set:

$items[‘administration’][‘tray’][‘toolbar_administration’][‘#pre_render’][0]

= ‘mymodule_prerender_toolbar_administration_tray’;
Then my mymodule_prerender_toolbar_administration_tray() function was basically a custom version of admin_toolbar_prerender_toolbar_administration_tray(), in which I made sure to set:

$tree = $menu_tree->load(‘owner-menu’, $parameters);

Dane Rossenrode
Dane Rossenrode
8 years ago

For me, since I wanted the menu to show for certain roles, I fetched the user:

$currentUser = \Drupal::currentUser();

Then did a check for the user role:

$currentUser->getRoles()

Jack Bussen
Jack Bussen
7 years ago

Thanks for the tip on Toolbar Menu module, thats what I was looking for! I also use [url=https://www.drupal.org/project/toolbar_themes]https://www.drupal.org/proj…[/url] to make it all smaller and looks better imo, cheers.

Hiral Abhinay Vyas
Hiral Abhinay Vyas
7 years ago

Hello
I want to display one menu i.e “Menu1” for one user role and “Menu 2” for another user role. When I am adding in tools, it shows all custom menus in it.
Thanks

Hiral

Hiral Abhinay Vyas
Hiral Abhinay Vyas
7 years ago

ok. thank you!

8
0
Would love your thoughts, please comment.x
()
x