4

I've noticed that the Bootstrap Navbar, while behaving like the 'Main menu' is not available to be enabled and disabled from the blocks admin page, furthermore at the admin menu admin/appearance/my-bootstrap-subtheme/settings there aren't any options to disable it...

Is there a line or option that I can add to the file at...

  • my-bootstrap-subtheme/templates/page.tpl.php

...that would disable it?

Alternatively perhaps there is something that can be edited inside the (parent) bootstrap file...

  • bootstrap/theme/settings.inc

around line 105 that would add a 'Disable Navbar' option at admin/appearance/my-bootstrap-subtheme/settings ...

Incidentally where would I put this edited settings.inc file inside my subtheme directory?

Thanks.

3 Answers 3

1

So to add this as an optional setting we can look at how it's done for other navbar variables. For example the navbar positioning which is on line 112 of that settings.inc

  $form['components']['navbar']['bootstrap_navbar_position'] = array(

Let's see where the variables you can select in that are referenced, such as fixed-top. It's referenced in html.vars.php where they implement the hook_preprocess_html() function to take that selection using theme_get_setting('bootstrap_navbar_position') and create some related variables to pass into the classes_array for the html.tpl.php.

So you can create a similar field with options like enabled and disabled and pass that on to the page.tpl.php using YOURTHEME_preprocess_page (which would probably go in template.php) to create a variable like navbar_on when it's enabled

if (theme_get_setting('bootstrap_navbar_enabled') == 'true') {
  $vars['navbar_on'] = '';

 }

and then check in page.tpl.php to see whether or not that's true or not before printing the page.

     <?php if ($navbar_on): ?>
          NAVBAR CODE
     <?php endif; ?>

EDIT: actually maybe this is already in the theme, just not very clear https://www.drupal.org/node/2287185

1

I am not getting why I did not give answer to this question, even I have kept this question in favorite list. Probably I would have miss understood the question or currently I am miss understanding a question. Anyway, I am sharing following information which might be helpful. If not relevant please let me know.

There is a option in Drupal by which, you can enable/disable main-menu and secondary menu. Even you can change the entire menu in-place of main-menu and secondary menu.

Example:

In following image main-menu and secondary menu, both are enabled.

enter image description here

If you go to structure/Menus/Settings/ you will find the following configuration page. Which provides the option of altering the main-menu and secondary menu, even disabling them as you can see in following screen-shot.

enter image description here

Now, if I select No main links and No secondary links it will disable both menu as show in the following image.

enter image description here

0

I would remove/comment out the output found in page.tpl.php. This will require you to output this menu via an alternate method, if you need it at all. It sounds like you just want it gone, in which case removing the output should suffice.

1
  • I want to be able to disable it rather than delete it though ... any idea how to add a check-box option under the existing nav-bar options at admin/appearance/settings ... Commented Jun 17, 2014 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.