-
Notifications
You must be signed in to change notification settings - Fork 0
/
drupalmoduleupgrader.module
124 lines (120 loc) · 3.03 KB
/
drupalmoduleupgrader.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
/**
* Implements hook_theme().
*/
function drupalmoduleupgrader_theme() {
return [
'dmu_block' => [
'variables' => [
'module' => 'MYMODULE',
'class' => 'MyBlock',
'block_id' => 'my_block_id',
'block_label' => \Drupal::translation()->translate('Untitled'),
'configurable' => FALSE,
],
'template' => 'Block',
],
'dmu_controller' => [
'variables' => [
'module' => 'MYMODULE',
],
'template' => 'Controller',
],
'dmu_entity_type' => [
'variables' => [
'module' => 'MYMODULE',
'class' => 'MyEntityType',
// This will be pretty much pulled directly out of hook_entity_info().
'info' => [],
],
'template' => 'EntityType',
],
'dmu_event_subscriber' => [
'variables' => [
'module' => 'MYMODULE',
'class' => 'MyConfigForm',
'event' => 0,
'priority' => 0,
],
'template' => 'EventSubscriber',
],
'dmu_form' => [
'variables' => [
'module' => 'MYMODULE',
'class' => 'MyForm',
'form_id' => 'my_form_id',
'config' => FALSE,
],
'template' => 'Form',
],
'dmu_formatter' => [
'variables' => [
'module' => 'MYMODULE',
'class' => 'MyFormatter',
'info' => [
'id' => 'formatter_id',
'label' => 'My Formatter',
'description' => 'Formatter description.',
'field_types' => [],
],
],
'template' => 'Formatter',
],
'dmu_issue' => [
'variables' => [
'issue' => NULL,
],
'template' => 'Issue',
],
'dmu_outbound_path_processor' => [
'variables' => [
'module' => 'MYMODULE',
],
'template' => 'OutboundPathProcessor',
],
'dmu_logger' => [
'variables' => [
'module' => 'MYMODULE',
],
'template' => 'Logger',
],
'dmu_route_subscriber' => [
'variables' => [
'module' => 'MYMODULE',
],
'template' => 'RouteSubscriber',
],
'dmu_report' => [
'variables' => [
'report' => NULL,
'issues' => [],
],
'template' => 'Report',
],
'dmu_widget' => [
'variables' => [
'module' => 'MYMODULE',
'class' => 'MyWidget',
'info' => [
'id' => 'widget_id',
'label' => 'My Widget',
'description' => 'Widget description goes here.',
'field_types' => [],
],
],
'template' => 'Widget',
],
];
}
function template_preprocess_dmu_report(array &$variables) {
$categories = \Drupal::config('drupalmoduleupgrader.tags')->get('category');
/** @var \Drupal\drupalmoduleupgrader\IssueInterface $issue */
foreach ($variables['report']->getIssues() as $issue) {
$category = $categories[ $issue->hasTag('category') ? $issue->getTag('category')[0] : 'misc' ];
$variables['issues'][$category][] = [
'#theme' => 'dmu_issue',
'#issue' => $issue,
];
}
ksort($variables['issues']);
}