This repository has been archived by the owner on Oct 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
druberg.module
97 lines (79 loc) · 2.27 KB
/
druberg.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* @file
* Hooks and functionality for druberg
*/
function druberg_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
//ksm($form);
}
function druberg_preprocess_table(&$variables) {
}
/*
function druberg_preprocess_container(&$variables) {
if (
isset($variables['element']['#module']) &&
$variables['element']['#module'] == 'druberg'
) {
$variables['directory'] = drupal_get_path('module', 'druberg');
$variables['theme_hook_suggestions'][] = 'container__druberg';
ksm($variables);
}
}
*/
function druberg_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
/*
if (isset($variables['element']['#attributes']['data-twig-suggestion'])) {
$element = $variables['element'];
$suggestions[] = $hook . '__' . $element['#attributes']['data-twig-suggestion'];
}
*/
// @todo - can we be sure that its always the first array in ['#submit']?
/*
if (
!empty($variables['element']['#submit'][0]) &&
is_array($variables['element']['#submit'][0]) &&
in_array('Drupal\druberg\Plugin\Field\FieldWidget\DrubergWidget', $variables['element']['#submit'][0]) &&
in_array('addMoreSubmit', $variables['element']['#submit'][0])
) {
$suggestions[] = $hook . '__' . 'druberg__addmore';
}
*/
}
/**
* Implements hook_theme().
*/
function druberg_theme() {
return array(
'druberg' => array(
'variables' => array('json' => NULL),
'template' => 'druberg',
),
'container-druberg' => array(
'variables' => array(),
'template' => 'container--druberg',
),
'radios-druberg' => array(
'variables' => array(),
'template' => 'radios--druberg',
),
'radio-druberg' => array(
'variables' => array(),
'template' => 'radio--druberg',
),
);
}
/*
function druberg_preprocess_container(&$variables) {
if (isset($variables['attributes']['data-twig-suggestion']) &&
$variables['attributes']['data-twig-suggestion'] === 'druberg') {
$variables['theme_hook_original'] = 'container__druberg';
ksm($variables);
}
}
*/
/**
* Implements hook_theme_registry_alter
*/
function druberg_theme_registry_alter(&$theme_registry) {
//$theme_registry['page']['path'] = drupal_get_path('module', 'my_module') . '/templates';
}