You are here

function hook_responsive_menu_off_canvas_output_alter in Responsive and off-canvas menu 4.4.x

Same name and namespace in other branches
  1. 4.3.x responsive_menu.api.php \hook_responsive_menu_off_canvas_output_alter()

Alter the variable which decides whether the off-canvas menu should be shown.

This hook is useful for developers who want some logic to determine whether the off-canvas menu is added to the page. For example a site may use a different menu for a member's area and the developer wants to disable the off-canvas mmenu for that section.

In this example the off-canvas menu is disabled when the Bartik theme is active.

Parameters

bool $output: A boolean that is TRUE by default. If FALSE the off-canvas menu will not be added to the DOM and the JavaScript libraries will not be loaded.

1 function implements hook_responsive_menu_off_canvas_output_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

responsive_menu_test_responsive_menu_off_canvas_output_alter in tests/modules/responsive_menu_test/responsive_menu_test.module
Implements hook_responsive_menu_off_canvas_output().
1 invocation of hook_responsive_menu_off_canvas_output_alter()
responsive_menu_page_bottom in ./responsive_menu.module
Implements hook_page_bottom().

File

./responsive_menu.api.php, line 98
Responsive menu module APIs.

Code

function hook_responsive_menu_off_canvas_output_alter(bool &$output) {
  if (\Drupal::service('theme.manager')
    ->getActiveTheme()
    ->getName() === 'bartik') {
    $output = FALSE;
  }
}