-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathEntityHandler.php
More file actions
48 lines (40 loc) · 1.2 KB
/
EntityHandler.php
File metadata and controls
48 lines (40 loc) · 1.2 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
<?php
namespace DrupalCodeBuilder\Generator;
use CaseConverter\CaseString;
/**
* Generator for entity handler classes.
*/
class EntityHandler extends PHPClassFile {
/**
* Define the component data this component needs to function.
*/
public static function componentDataDefinition() {
$data_definition = parent::componentDataDefinition() + [
'entity_type_id' => [
'internal' => TRUE,
// Means the ComponentCollector should copy in the property from the
// requesting component.
'acquired' => TRUE,
],
'entity_class_name' => [
'internal' => TRUE,
'acquired' => TRUE,
],
'entity_type_label' => [
'internal' => TRUE,
'acquired' => TRUE,
],
'handler_type' => [
'internal' => TRUE,
],
'handler_label' => [
'internal' => TRUE,
],
];
// Note that relative_class_name is given by the entity type component.
$data_definition['docblock_first_line']['default'] = function ($component_data) {
return "Provides the {$component_data['handler_label']} handler for the {$component_data['entity_type_label']} entity.";
};
return $data_definition;
}
}