1 | <?php |
||
9 | final class EntityDrupalWrapper |
||
10 | { |
||
11 | /** |
||
12 | * Entity type. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | private $type = ''; |
||
17 | /** |
||
18 | * Entity bundle. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | private $bundle = ''; |
||
23 | /** |
||
24 | * Entity object. |
||
25 | * |
||
26 | * @var object |
||
27 | */ |
||
28 | private $entity; |
||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | private $fields = [ |
||
33 | 'locators' => [], |
||
34 | 'required' => [], |
||
35 | ]; |
||
36 | |||
37 | /** |
||
38 | * @param string $entityType |
||
39 | * @param string $bundle |
||
40 | */ |
||
41 | public function __construct($entityType, $bundle = '') |
||
55 | |||
56 | public function load($id) |
||
74 | |||
75 | public function hasField($fieldName) |
||
82 | |||
83 | public function getFieldValue($fieldName) |
||
90 | |||
91 | /** |
||
92 | * @param string $fieldName |
||
93 | * Machine name or label of a field. |
||
94 | * |
||
95 | * @return string |
||
96 | */ |
||
97 | public function getFieldNameByLocator($fieldName) |
||
101 | |||
102 | /** |
||
103 | * @return array[] |
||
104 | */ |
||
105 | public function getRequiredFields() |
||
109 | |||
110 | /** |
||
111 | * @return object |
||
112 | */ |
||
113 | protected function getEntity() |
||
121 | } |
||
122 |