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
- 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.
Comment | File | Size | Author |
---|---|---|---|
#9 | add_toolbar_integration-2839502-9.patch | 25.93 KB | willzyx |
| |||
#8 | add_toolbar_integration-2839502-8.patch | 25.9 KB | willzyx |
| |||
#2 | add_toolbar_integration-2839502-2.patch | 25.78 KB | willzyx |
| |||
toolbar-config.jpg | 69.09 KB | willzyx | |
toolbar-vertical.jpg | 100.73 KB | willzyx |
Comments
Comment #2
willzyx CreditAttribution: willzyx commentedComment #3
lussolucaThe Devel menu is also accessible through the web profiler toolbar, are we sure that we want to replicate the menu somewhere else?
Comment #4
willzyx CreditAttribution: willzyx commented@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.
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedI think toolbar integration makes sense for devel, even considering our webprofiler integration.
Comment #6
willzyx CreditAttribution: willzyx commented@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.
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedI slightly prefer 2).
Comment #8
willzyx CreditAttribution: willzyx commentedHere a patch that integrate the feature directly in devel.
this is still valid. We have no simple ways to make the toolbar config optional and enable it only when toolbar module is enabled
Comment #9
willzyx CreditAttribution: willzyx commentedrerolled
Comment #10
willzyx CreditAttribution: willzyx commentedLooks quite ready. Anyone want to review?
Comment #11
willzyx CreditAttribution: willzyx commentedIf no one have objections/suggestions I'm going to commit this in the next few days
Comment #12
lussoluca+1 for me, just a very trivial nitpick:
s/teh/the/
Comment #14
willzyx CreditAttribution: willzyx commentedfixed on commit.
Committed and pushed to 8.x. Thanks!