It would be useful to have a function to programatically suppress the output of the toolbar menu. This would be used in cases such as when using the modal frame api (i.e. you don't want a toolbar in a modal window). Both the admin menu and admin modules already have a similar functionality.
This patch adds a new function toolbar_suppress() which is checked in hook_footer and doesn't populate the footer if the toolbar is meant to be suppressed.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | toolbar-programatically-suppress-toolbar-883134-2.patch | 802 bytes | dankh |
| #5 | toolbar-programatically-suppress-toolbar-883134.patch | 479 bytes | dankh |
| toolbar_suppress.patch | 751 bytes | hadsie |
Comments
Comment #1
dankh commentedGreat idea, thank you ! I have just added one more check in the function :
Comment #2
dankh commentedhttp://drupal.org/cvs?commit=408850
Comment #4
decipheredCSS and JS is still attached even if menu is suppressed.
Comment #5
dankh commentedConfirmed. Please review and test patch.
Comment #6
decipheredUnfortunately the problem with detecting for _suppress() in hook_init() is that if the module trying to invoke the suppress is weighted after Toolbar it won't be able to call suppress before it's checked for.
If the CSS and JS need to be added in hook_init() then they will need to be done in a way that they don't do anything unless the the content added during hook_footer() is present.
Comment #7
dankh commentedOk, I get your point. hook_preprocess_page is executed before hook_init. So I moved the css and js includes in hook_preprocess_page this way regardless the module weight the suppress will work. I have tested already even with weight tweaking. Please review and test.
Comment #8
dankh commentedComment preview doesn't work with attachments so again here is the patch.
Comment #9
decipheredLooks good. Marking as RTBC.
Now Admin, Admin Menu and Toolbar can all live in unison via the Administration Menu select module :)