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.

Comments

dankh’s picture

Status: Needs review » Reviewed & tested by the community

Great idea, thank you ! I have just added one more check in the function :

if (!empty($set) && $suppress === FALSE) {
  $suppress = TRUE;
}                                 
dankh’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

deciphered’s picture

Category: feature » bug
Status: Closed (fixed) » Active

CSS and JS is still attached even if menu is suppressed.

dankh’s picture

Assigned: Unassigned » dankh
Status: Active » Needs review
StatusFileSize
new479 bytes

Confirmed. Please review and test patch.

deciphered’s picture

Status: Needs review » Needs work

Unfortunately 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.

dankh’s picture

Title: Programatically suppress toolbar output » Programatically suppress toolbar output
Status: Needs work » Needs review

Ok, 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.

dankh’s picture

Comment preview doesn't work with attachments so again here is the patch.

deciphered’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Marking as RTBC.

Now Admin, Admin Menu and Toolbar can all live in unison via the Administration Menu select module :)