-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgovau_uikit_theme.theme
53 lines (45 loc) · 1.67 KB
/
govau_uikit_theme.theme
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
<?php
use Drupal\Component\Utility\Html;
use Drupal\Core\Url;
use Drupal\Core\Link;
use Drupal\Core\Template;
/**
*
* Implements hook_theme_suggestions_HOOK_alter
*
**/
function govau_uikit_theme_preprocess_input__checkbox(&$variables) {
$variables['element']['#wrapped_label'] = TRUE;
}
function govau_uikit_theme_theme_suggestions_form_element_alter(&$suggestions, $variables) {
if($variables['element']['#type'] == 'checkbox') {
$suggestions[] = 'form_element__wrapped';
}
}
function govau_uikit_theme_preprocess_form_element__wrapped(&$variables) {
$variables['label']['#theme'] = 'form_element_label__open';
$variables['label_open'] = $variables['label'];
unset($variables['label']);
$variables['title'] = $variables['element']['#title'];
}
function govau_uikit_theme_theme_suggestions_form_element_label_alter(&$suggestions, &$vars) {
$request['type'] = $vars['element']['type']['type'];
if(!empty($request)) {
$suggestions[] = 'form_element_label__' . $request['type'];
}
}
function govau_uikit_theme_preprocess_block(&$variables) {
$variables['content']['#attributes']['block'] = $variables['attributes']['id'];
}
/**
* Implements hook_theme_suggestions_HOOK_alter().
* Ensure same block can render in the different behaviour.
*/
function govau_uikit_theme_theme_suggestions_menu_alter(array &$suggestions, array $variables) {
// Remove the block and replace dashes with underscores in the block ID to
// use for the hook name.
if (isset($variables['attributes']['block'])) {
$hook = str_replace(array('block-', '-'), array('', '_'), $variables['attributes']['block']);
$suggestions[] = $variables['theme_hook_original'] . '__' . $hook;
}
}