-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoogle_kpis.module
More file actions
executable file
·56 lines (49 loc) · 1.35 KB
/
google_kpis.module
File metadata and controls
executable file
·56 lines (49 loc) · 1.35 KB
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
<?php
/**
* @file
* Contains google_kpis.module.
*/
use Drupal\Core\Render\Element;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function google_kpis_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the google_kpis module.
case 'help.page.google_kpis':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Fetch and Store data from Google Analytics and Google Search Console') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function google_kpis_theme() {
return [
'google_kpis' => [
'render element' => 'elements',
],
];
}
/**
* Prepares variables for Google kpis templates.
*
* Default template: google_kpis.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_google_kpis(array &$variables) {
// Fetch GoogleKpis Entity Object.
$google_kpis = $variables['elements']['#google_kpis'];
// Helpful $content variable for templates.
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
}