-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathReportEventNames.php
More file actions
94 lines (78 loc) · 1.87 KB
/
ReportEventNames.php
File metadata and controls
94 lines (78 loc) · 1.87 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
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
<?php
namespace DrupalCodeBuilder\Task;
use MutableTypedData\Definition\OptionSetDefininitionInterface;
use DrupalCodeBuilder\Task\Report\SectionReportInterface;
/**
* Task handler for reporting on event names.
*/
class ReportEventNames extends ReportHookDataFolder implements OptionSetDefininitionInterface, SectionReportInterface {
use OptionsProviderTrait;
use SectionReportSimpleCountTrait;
/**
* The sanity level this task requires to operate.
*/
protected $sanity_level = 'component_data_processed';
/**
* {@inheritdoc}
*/
protected $saveDataKey = 'event_names';
/**
* The name of the method providing an array of options as $value => $label.
*/
protected static $optionsMethod = 'listEventNamesOptions';
/**
* The data.
*/
protected $data;
/**
* {@inheritdoc}
*/
public function getInfo(): array {
return [
'key' => 'event_names',
'label' => 'Event names',
'weight' => 22,
];
}
/**
* {@inheritdoc}
*/
public function getDataSummary(): array {
return $this->loadData();
}
/**
* Get the list of data types data.
*
* @return
* The processed data types data.
*/
public function listEventNames() {
return $this->loadData();
}
/**
* Get a list of options for data types.
*
* @return
* An array of data types as options suitable for FormAPI.
*/
public function listEventNamesOptions() {
$data = $this->loadData();
$return = [];
foreach ($data as $id => $data_item) {
$return[$id] = $id;
}
return $return;
}
/**
* Loads the data type data from storage.
*
* @return
* The data array, as stored by the DataTypesCollector.
*/
protected function loadData() {
if (!isset($this->data)) {
$this->data = $this->environment->getStorage()->retrieve($this->saveDataKey);
}
return $this->data;
}
}