-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfancy_local_tasks.module
43 lines (37 loc) · 1.17 KB
/
fancy_local_tasks.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @file
* Provide module that adds sticky local tasks bar to the bottom of the page.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function fancy_local_tasks_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the customization module.
case 'help.page.fancy_local_tasks':
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Fancy local tasks module') . '</p>';
return $output;
default:
return '';
}
}
/**
* Implements hook__preprocess_page().
*/
function fancy_local_tasks_preprocess_page(&$variables) {
if ($variables['logged_in'] && !\Drupal::service('router.admin_context')
->isAdminRoute()) {
$variables['#attached']['library'][] = 'fancy_local_tasks/fancy-local-tasks';
}
}
/**
* Implements hook_theme_registry_alter().
*/
function fancy_local_tasks_theme_registry_alter(&$theme_registry) {
if (!\Drupal::service('router.admin_context')->isAdminRoute()) {
$theme_registry['menu_local_tasks']['path'] = Drupal\Core\Extension\ExtensionPathResolver::getPath('module', 'fancy_local_tasks') . '/templates';
}
}