toolbar_visibility.module in Toolbar Visibility 8
Same filename and directory in other branches
Contains toolbar_visibility.module.
File
toolbar_visibility.moduleView source
<?php
/**
* @file
* Contains toolbar_visibility.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function toolbar_visibility_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the toolbar_visibility module.
case 'help.page.toolbar_visibility':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Choose theme to show the toolbar') . '</p>';
return $output;
default:
}
}
function toolbar_visibility_page_top(array &$page_top) {
$current_theme_name = \Drupal::theme()
->getActiveTheme()
->getName();
$theme_to_exclude_toolbar = \Drupal::config('toolbar_visibility.default_config')
->get('toolbar_visibility_theme');
if ($theme_to_exclude_toolbar) {
//dpm($theme_to_exclude_toolbar);
foreach ($theme_to_exclude_toolbar as $key => $theme_name) {
if ($theme_name == $current_theme_name) {
if (isset($page_top['toolbar'])) {
unset($page_top['toolbar']);
}
}
}
}
}
/**
* Implements hook_theme().
*/
function toolbar_visibility_theme() {
$theme = [];
return $theme;
}
Functions
Name | Description |
---|---|
toolbar_visibility_help | Implements hook_help(). |
toolbar_visibility_page_top | |
toolbar_visibility_theme | Implements hook_theme(). |