Follow-up to #1817106: Make devel menu items more accessible

Problem/Motivation

  • It is very difficult to use devel menu items without devel menu block.
  • Sometimes developer is working with multiple themes and it is not possible to add devel menu block to all themes sidebars.
  • Some themes has no sidebar like seven so there is no region to add devel menu. So during development if you want to use devel menu items there is no way you can access it.

Solutions

  1. We can take advantage of the toolbar module in core and add toolbar integration for devel menu in the 8.x branch for make devel menu items more accessible

Here how the proposed implementation looks like:

By default, when the toolbar orientation is horizontal, it shows few items (we have not a lot of space). The items to show are configurables


when the toolbar orientation is vertical, it shows all the enabled top level items picked up from the devel menu


The user can select how many and which items are always visible in the toolbar tray


Currently devel menu is uncacheable, so instead of poisoning the entire page cache the implementation uses a lazy builder for build the toolbar tray. This can be very useful in some circumstances (eg when you are debbugging cache metadata you can avoid to disable devel's menu and maintain all the devel features handy)

I put the feature in a new module in /modules/devel_toolbar but I have not strong opinion on where it should be placed. It can be a module distribute with devel (as in the patch), it can be integrates directly in devel or can be distributed as separate module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

willzyx created an issue. See original summary.

willzyx’s picture

Status: Active » Needs review
FileSize
25.78 KB
lussoluca’s picture

The Devel menu is also accessible through the web profiler toolbar, are we sure that we want to replicate the menu somewhere else?

willzyx’s picture

@luca I really think that this should be available in the Devel module itself. It is very hard to use devel menu items without devel menu block, devel features are not handy.. and a lot of new users not understand how to use the devel features when they enable the module.

moshe weitzman’s picture

I think toolbar integration makes sense for devel, even considering our webprofiler integration.

willzyx’s picture

@moshe @luca
if we want to ship this with devel we should decide where to put this feature. IMO we have a couple of options:

1) as done in the patch - create a new module distributed with devel
pro: self contained - depends on devel and toolbar
cons: the users need to know that this module exists and need to enable it if they want to use this feature

2) integrate the feature directly in devel module
pro: the feature is enabled by default if toolbar is enabled
cons:
- since seems that there is not a way for add dependencies to a module in a simple configuration (no config entity) the devel toolbar config is always active even if toolbar module is disabled
- we need to do some other extra check for verify if toolbar is enabled in more than one point.
- we should add other code to the huge devel codebase.

moshe weitzman’s picture

I slightly prefer 2).

willzyx’s picture

Here a patch that integrate the feature directly in devel.

since seems that there is not a way for add dependencies to a module in a simple configuration (no config entity) the devel toolbar config is always active even if toolbar module is disabled

this is still valid. We have no simple ways to make the toolbar config optional and enable it only when toolbar module is enabled

willzyx’s picture

willzyx’s picture

Looks quite ready. Anyone want to review?

willzyx’s picture

If no one have objections/suggestions I'm going to commit this in the next few days

lussoluca’s picture

Status: Needs review » Reviewed & tested by the community

+1 for me, just a very trivial nitpick:

+++ b/tests/src/Functional/DevelToolbarTest.php
@@ -0,0 +1,268 @@
+    // Ensures that the configure link in teh toolbar is present and point to

s/teh/the/

  • willzyx committed 70f62fd on 8.x-1.x
    Issue #2839502 by willzyx: Add toolbar integration - make devel menu...
willzyx’s picture

Status: Reviewed & tested by the community » Fixed
+++ b/tests/src/Functional/DevelToolbarTest.php
@@ -0,0 +1,268 @@
+    // Ensures that the configure link in teh toolbar is present and point to

fixed on commit.

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.