Problem/Motivation

Toolbar doesn't have to just be for admins. Many sites are trying to give content editors or even regular authenticated users access to shortcuts, but currently that's only possible via ugly blocks, not the slick toolbar/shortcut integration. There's no reason toolbar requires a user to be an "administrator".

Proposed resolution

  1. Rebrand toolbar to not imply or require "administration".
  2. Grant access toolbar permission to all authenticated users by default in the Standard install profile.
  3. Hide the default "User account" secondary menu block for authenticated users, because it's useless if you have those links via the toolbar already. It's needed for anonymous users, since this is the menu/block providing the 'Log in' link. We can leave all the plumbing for the menu + block (even for authenticated users) since not every site will necessarily want to embrace toolbar in this way, and some might still prefer the "User account" menu + block approach.

Remaining tasks

  1. Commit blocking child issues:
  2. Decide if shortcut should depend on toolbar, and if so, make it happen. Otherwise, come up with a good way to suggest/encourage site builders to enable + use the toolbar if they're using shortcut. composer.json's suggest comes to mind, but we don't support anything like that in core itself (right?)
  3. Grant access toolbar permission to all authenticated users by default in the Standard install profile.
  4. Use role visibility to only show the "User account" secondary menu block for anonymous users.
  5. Make sure all users get a reasonable default shortcut set in the Standard install profile, not just admins. @todo Follow-up issue for this?

Once all this is done, #2377543: Add "Add" item to toolbar would be a big usability win as the next step.

User interface changes

These changes would only impact new installations using the 'Standard' install profile. Existing site owners/builders would have to reconfigure their site(s) if they want any of this:

  • All authenticated users would see the toolbar.
  • "User account" secondary menu block would be hidden for authenticated users (usually rendered the top right of the header region in most themes) in favor of the user tray in the toolbar.
  • Possibly others (TBD)?

API changes

None.

Data model changes

None.

Release notes snippet

TBD.

Original report by @davidneedham

If you have the shortcut bar enabled and disable the toolbar module, the shortcut no longer appears. I would expect the shortcut bar to still exist, regardless of if the toolbar module is enabled or not.

If this is not a bug and this is the way that the shortcut module is intended to work, then the shortcut module should have a listed dependency on the toolbar module.

Comments

montesq’s picture

Status: Active » Closed (works as designed)

In fact when the toolbar is activated, the shortcuts are displayed juste below the admin bar.
But when the toolbar is disabled, you are able to place a block in your layout to display the shortcuts...

David_Rothstein’s picture

Title: Shortcut bar disappears when toolbar module is disabled » Shortcut bar should still be able to display at the top of the screen without a toolbar enabled
Version: 7.0 » 8.x-dev
Category: bug » feature
Status: Closed (works as designed) » Active

Right, this is definitely not a bug, since the shortcut module works fine without the toolbar module enabled.

I can see it as a legitimate feature request (for Drupal 8) though. Maybe it would make sense to have an option where you can still have the shortcuts appear in a bar across the top of the screen, even without the core toolbar module (or any other toolbar-providing module) enabled. Not sure if that's a good idea or not, but let's leave the issue open for that possibility?

damienmckenna’s picture

Right now there's massive confusion between the Toolbar and Shortcut modules as to how they should work both separately and together. The Toolbar module a not dependency of the Shortcut module, but out of the box if you only enable the Shortcut module you do not get any shortcuts bar. I think this should be resolved in one of two ways:

  • The Toolbar module is defined as a dependency of the Shortcut module,
  • The Shortcut module is extended to display the shortcut bar without the Toolbar module being enabled.

Without one of these two being done there will continue to be a major confusion over their usage.

jurriaanroelofs’s picture

Right, this is definitely not a bug, since the shortcut module works fine without the toolbar module enabled.

The block that is available is useless because there is not region in the seven theme where you can put it and have it appear in the right place.

andypost’s picture

For current D8 state it makes more sense to implement a shortcut-list as block plugin, which could be rendered in any region of layout

EDiT probably block could be configured #1122816: Assign shortcut set to role to limit number of items to display #1304486-17: Completely remove the ability to limit the number of shortcuts per set to provide upgrade path

wim leers’s picture

Title: Shortcut bar should still be able to display at the top of the screen without a toolbar enabled » Enable toolbar for authenticated users also, so that non-admin users can use shortcuts as well
Issue summary: View changes
Status: Active » Needs review
Issue tags: +Usability, +Novice
StatusFileSize
new69.7 KB
new73.36 KB
new6.44 KB

So essentially this would be a simplified version of the new D8 toolbar — but then with only the shortcuts.

I think with the new D8 toolbar, we've gained some flexibility that allows a new solution.

I propose:

  1. make shortcut depend on toolbar
  2. change toolbar's t('Use the administration toolbar') to t('Use the toolbar')
  3. grant this permission to all authenticated users by default in the Standard install profile
  4. make sure that the "Manage" toolbar tab is not displayed if the user cannot access any of the admin menu links anyway (this would be a bugfix)
  5. and then of course remove the default "User account" secondary menu, because it's useless if you have those links via the toolbar already.

The end result then looks and feels much more modern — a responsive toolbar is much more useful than a tiny "Log out" link placed awkwardly.

Bojhan’s picture

I am not sure if its desirable to have this enabled by default for authenticated users. I can imagine you would want this enabled by default for your editors. Other than that the patch looks great, we should open this functionality to more people.

andypost’s picture

Once menu trees are cachable it makes a lot of sense!
But suppose that toolbar should check module_exists() for shortcut like language module glue all over the core

+++ b/core/modules/menu_ui/config/install/menu_ui.settings.yml
@@ -1,3 +1,3 @@
-secondary_links: account
+secondary_links: ''

Any reason for?

+++ b/core/modules/shortcut/shortcut.info.yml
@@ -5,3 +5,5 @@ package: Core
+dependencies:
+  - toolbar

shortcut is a storage module, toolbar is frontend module

andypost’s picture

@Wim is there a way to implement toolbar buttons as plugins? or a kind of menu block module to display subtrees which was just ported #474004-46: Add options to system menu block so primary and secondary menus can be blocks rather than variables

wim leers’s picture

#8:

But suppose that toolbar should check module_exists() for shortcut like language module glue all over the core

Toolbar doesn't assume that Shortcut is present, so I don't get this?

Any reason for?

Yes: and then of course remove the default "User account" secondary menu, because it's useless if you have those links via the toolbar already.

shortcut is a storage module, toolbar is frontend module

Eh… I don't see why this matters. Probably related to your first remark?

#9: not right now, but I can see that making sense. You should talk to Jesse Beach to figure out why that wasn't done in the first place. I'm betting the plugin system wasn't ready back when Toolbar went in. This is highly off-topic though.

wim leers’s picture

(FYI: there's also the Contextual Links Trigger (pencil icon) in the toolbar and the Tour trigger — neither of those are in any way related to menus — I can see why you might think that the Toolbar is a specialized menu renderer because of the admin menu, shortcuts and user profile links that it renders.)

Status: Needs review » Needs work

The last submitted patch, 6: shortcuts_for_non_admin_users-1044090-6.patch, failed testing.

Motlem’s picture

I achieved this functionality in kind of a round-about way. I wanted to display the shortcuts bar for some roles, but the admin toolbar only for the administrative role. I am using the shortcuts per role module, so have shortcut sets defined on a per role basis, but wanted to just use the stock shortcut bar.

In my theme's page.tpl.php file, I included the following snippet to pass the user roles in order to use them in my JavaScript file:

  drupal_add_js(array('Theme' => array('role' => $GLOBALS['user']->roles)), 'setting');

  drupal_add_js(drupal_get_path('theme', 'Theme') . 'path to js file', 'file');

In my JavaScript file, I then checked the roles array for the admin role and flipped a switch if the 'administrator' role was there.

I then used jQuery to remove the toolbar element unless the 'administrator' role was detected, leaving the stock shortcut bar intact.

Drupal.behaviors.Theme = {
	attach: function (context, settings) {
	  var roleArr = Drupal.settings.Theme.role;
	  var isAdmin = false;
	  for (role in roleArr) {
	  	if (roleArr[role] == 'administrator') {
	  		isAdmin = true;
	  	}
	  }
	  if (isAdmin == false) {
	  	$('.toolbar-menu').remove();
	  }
	}
};

I of course set the permissions of the roles I want to have the shortcut bar to be able to "Use the administrative toolbar".

If those roles also have permission to "View the administration theme", you can duplicate this in your administrative theme in its page.tpl.php and js files to remove the toolbar for all but your selected roles.

Bojhan’s picture

Version: 8.0.x-dev » 8.1.x-dev
abhiklpm’s picture

The shortcut icon should appear if core toolbar is disabled. If its not appearing you need to check the settings in this page also. Cheked in D7 version only.

admin/config/administration/admin_menu

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: shortcuts_for_non_admin_users-1044090-6.patch, failed testing.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dww’s picture

Should we split off as a separate bug report the fact that if you configure the toolbar for a given role that doesn't have access to anything under admin/* that you get a "Manage" button that doesn't appear to do anything at all? That's point 4 from @Wim's comment #6. I know this "feature" is about making that a more common use-case, and enabling the toolbar by default. But it sure seems like a bug to have an empty manage button. Is this the issue to fix that, or can we call that a bug and fix that independently of the rest of the proposals in here?

Cheers,
-Derek

dww’s picture

Re: #24, I now see that bug report already exists at #2135445: Toolbar displays Manage tab even if the user is not permitted to see it. I'll put my energy there. ;)

Cheers,
-Derek

dww’s picture

Title: Enable toolbar for authenticated users also, so that non-admin users can use shortcuts as well » [PP-1] Enable toolbar for authenticated users also, so that non-admin users can use shortcuts as well
Status: Needs work » Postponed
Issue tags: -Novice

There's now a working patch with all green tests at #2135445: Toolbar displays Manage tab even if the user is not permitted to see it. That's a blocker to the rest of this happening. Anyone interested in this is invited to help get that to RTBC and committed.

Also, after looking more closely at the code, I think nothing about the toolbar is "Novice" material. ;) Certainly not a change of this size and scope.

dww’s picture

Title: [PP-1] Enable toolbar for authenticated users also, so that non-admin users can use shortcuts as well » [PP-2] Enable toolbar for authenticated users also, so that non-admin users can use shortcuts as well
Issue summary: View changes

Split #6.2 out to a separate child issue: #3025839: Change toolbar's permission label to 'Use the toolbar'

Updated summary to use the template, and make this a proper parent issue to coordinate this effort.

dww’s picture

Issue summary: View changes

From remaining tasks:

4. Remove the default "User account" secondary menu, because it's useless if you have those links via the toolbar already.

I'm playing with this locally now. This statement isn't true. The secondary menu is what's providing the "Log in" link for anonymous users. :/ We'll either need:

A) Leave the menu and block, but use role visibility to configure it to only appear for anonymous users? It seems sad to have code creating other menu items for this menu when they'll never really be displayed. Then again, not everyone is going to want to embrace toolbar. So probably we can leave it alone, and just do the role visibility thing in Standard.

or

B) Build an alternate solution for the anonymous "Log in" link that's not a menu + block (ugh?).

wim leers’s picture

  1. EXCITING PROGRESS! 💪 🎉
  2. This statement isn't true.

    You're right. It's only true for authenticated users. +1 for changing the default block visibility to only show it to anon users instead (you added that to the issue summary but not in #28).

dww’s picture

Component: shortcut.module » toolbar.module
Issue summary: View changes
Related issues: +#2377543: Add "Add" item to toolbar

#29.1: Thanks! :)

#29.2: Righto. Clarified the summary even further. I also added this as a remaining task:

* Make sure all users get a reasonable default shortcut set in the Standard install profile, not just admins. @todo Follow-up issue for this?

Thoughts? Seems smart to do that in a separate issue since it would benefit non-toolbar sites already and it'd be changes in a different module.

Also, in remaining tasks, the child issues are both RTBC, so removed that. Yay! :)

Finally, this is really a toolbar issue, not shortcut. Shortcut is one of the main beneficiaries, but user is making good use of toolbar already. #2377543: Add "Add" item to toolbar would also be a big win with this, even without shortcut enabled at all.

wim leers’s picture

Make sure all users get a reasonable default shortcut set in the Standard install profile, not just admins. @todo Follow-up issue for this?

Thoughts? Seems smart to do that in a separate issue since it would benefit non-toolbar sites already and it'd be changes in a different module.

👌

larowlan’s picture

Title: [PP-2] Enable toolbar for authenticated users also, so that non-admin users can use shortcuts as well » [PP-1] Enable toolbar for authenticated users also, so that non-admin users can use shortcuts as well
dww’s picture

@larowlan re: #32: Great, thanks!

Another thing we should try to clean up, either here or a sub-issue, is that the toolbar's div has the id "toolbar-administration". I added an @todo to the test case for #2135445-58: Toolbar displays Manage tab even if the user is not permitted to see it about this and pointed here. We could update that @see if we want to open a child issue for this, or fix directly as part of this.

dww’s picture

Title: [PP-1] Enable toolbar for authenticated users also, so that non-admin users can use shortcuts as well » Enable toolbar for authenticated users also, so that non-admin users can use shortcuts as well
Issue summary: View changes
Status: Postponed » Active

#2135445: Toolbar displays Manage tab even if the user is not permitted to see it is also in 8.7.x now! That's a legit candidate for 8.6.x backport, but that's pending the thawing of a (temporary?) code freeze (which is why it remains RTBC for 8.6.x branch). Regardless, this issue is clearly 8.7.x-only material, so there's no need for it to remain blocked.

Updated remaining tasks accordingly.

Patch #6 is so stale that NW is misleading. Let's start fresh at active again. ;)

Cheers,
-Derek

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

quietone’s picture

Status: Active » Postponed

The Toolbar Module was approved for removal in #3476882: [Policy] Move Toolbar module to contrib.

This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3484850: [meta] Tasks to deprecate Toolbar module and the removal work in #3488828: [meta] Tasks to remove Toolbar module.

Toolbar will be moved to a contributed project before Drupal 12.0.0 is released.

quietone’s picture

Project: Drupal core » Toolbar
Version: main » 1.x-dev
Component: toolbar.module » Code
Status: Postponed » Active

Toolbar module has moved to contrib.