-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitefeedback.module
executable file
·59 lines (49 loc) · 1.36 KB
/
sitefeedback.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* @file
* Module file.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function sitefeedback_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the sitefeedback module.
case 'help.page.sitefeedback':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('This module is used to provide site feedback to admins of a system.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function sitefeedback_theme($existing, $type, $theme, $path) {
return [
'feedback_view' => [
'variables' => ['feedback' => NULL],
],
];
}
/**
* Implements hook_page_bottom().
*/
function sitefeedback_page_bottom(array &$page_bottom) {
// Attach add feedback button to bottom right of the page if the current
// user has access.
if (Drupal::currentUser()->hasPermission('provide site feedback')) {
$addLink = '<a class="use-ajax feedback-add-btn"
data-dialog-options="{"width":400}"
data-dialog-type="modal"
href="/admin/sitefeedback/add"><span>'
. t('Feedback') .
'</span></a>';
$page_bottom['site_feedback'] = [
'#markup' => $addLink,
];
$page_bottom['#attached']['library'][] = 'sitefeedback/sitefeedbackadmin';
}
}