forked from nuvoleweb/ui_patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui_patterns.module
More file actions
55 lines (46 loc) · 1.35 KB
/
ui_patterns.module
File metadata and controls
55 lines (46 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
<?php
/**
* @file
* Contains ui_patterns.module.
*/
use Drupal\ui_patterns\UiPatterns;
/**
* Implements hook_theme().
*/
function ui_patterns_theme() {
/** @var \Drupal\ui_patterns\Plugin\PatternBase $pattern */
$items = [
'patterns_destination' => [
'variables' => ['sources' => NULL, 'context' => NULL],
],
'patterns_use_wrapper' => [
'variables' => ['use' => NULL],
],
];
foreach (UiPatterns::getManager()->getPatterns() as $pattern) {
$items += $pattern->getThemeImplementation();
}
return $items;
}
/**
* Implements hook_library_info_build().
*/
function ui_patterns_library_info_build() {
/** @var \Drupal\ui_patterns\Plugin\PatternBase $pattern */
$definitions = [];
foreach (UiPatterns::getManager()->getPatterns() as $pattern) {
$definitions += $pattern->getLibraryDefinitions();
}
return $definitions;
}
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function ui_patterns_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
if (UiPatterns::getManager()->isPatternHook($hook)) {
\Drupal::moduleHandler()->alter('ui_patterns_suggestions', $suggestions, $variables, $variables['context']);
}
if ($hook == 'patterns_destination') {
\Drupal::moduleHandler()->alter('ui_patterns_destination_suggestions', $suggestions, $variables, $variables['context']);
}
}