forked from nuvoleweb/ui_patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui_patterns.api.php
37 lines (32 loc) · 1.03 KB
/
ui_patterns.api.php
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
<?php
use Drupal\ui_patterns\Element\PatternContext;
/**
* Alter UI Patterns definitions.
*
* @see \Drupal\ui_patterns\UiPatternsManager
*/
function hook_ui_patterns_info_alter(&$definitions) {
$definitions['my_pattern']['label'] = 'My new label';
}
/**
* Alter UI Patterns Source definitions.
*
* @see \Drupal\ui_patterns\Plugin\UiPatternsSourceManager
*/
function hook_ui_patterns_ui_patterns_source_info_alter(&$definitions) {
$definitions['my_field_source']['tags'][] = 'new_tag';
}
/**
* Provide hook theme suggestions for patterns.
*
* @see ui_patterns_theme_suggestions_alter()
*/
function hook_ui_patterns_suggestions_alter(array &$suggestions, array $variables, PatternContext $context) {
if ($context->isOfType('views_row')) {
$hook = $variables['theme_hook_original'];
$view_name = $context->getProperty('view_name');
$display = $context->getProperty('display');
$suggestions[] = $hook . '__views_row__' . $view_name;
$suggestions[] = $hook . '__views_row__' . $view_name . '__' . $display;
}
}