From e3389576b2539d79d9546b6fbd9b35ddd37c98fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Rene=CC=81e=20Beach?= Date: Wed, 13 Nov 2013 18:28:06 -0500 Subject: [PATCH] Issue #1728726 by iler, realityloop, Dave Reid, jessebeach: Support hook_suppress() to hide the navbar. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: J. ReneĢe Beach --- navbar.module | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/navbar.module b/navbar.module index f11671a..16e0ce0 100644 --- a/navbar.module +++ b/navbar.module @@ -190,6 +190,9 @@ function _navbar_initialize_page_cache() { * Add admin navbar to the page_top region automatically. */ function navbar_page_build(&$page) { + if (navbar_suppress(FALSE)) { + return; + } $page['page_top']['navbar'] = array( '#type' => 'navbar', '#access' => user_access('access navbar'), @@ -964,3 +967,25 @@ function navbar_convert_libraries_to_library($library, $options) { return $converted; } + +/** + * Implementation of hook_suppress() + * + * Allows other modules to suppress display of Navbar + * + * This function should be called from within another module's page callback + * (preferably using module_invoke()) when the navbar should not be displayed. + * This is useful for modules that implement popup pages or other special + * pages where the navbar would be distracting or break the layout. + * + * @param $set + * Defaults to TRUE. If called before hook_footer(), the navbar will not be + * displayed. If FALSE is passed, the suppression state is returned. + **/ +function navbar_suppress($set = TRUE) { + static $suppress = FALSE; + if (!empty($set) && $suppress === FALSE) { + $suppress = TRUE; + } + return $suppress; +} -- 1.8.2