1 | <?php |
||
50 | class EntityBrowser extends ConfigEntityBase implements EntityBrowserInterface, EntityWithPluginCollectionInterface { |
||
51 | |||
52 | /** |
||
53 | * The name of the entity browser. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | public $name; |
||
58 | |||
59 | /** |
||
60 | * The entity browser label. |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | public $label; |
||
65 | |||
66 | /** |
||
67 | * The display plugin id. |
||
68 | * |
||
69 | * @var string |
||
70 | */ |
||
71 | public $display; |
||
72 | |||
73 | /** |
||
74 | * The display plugin configuration. |
||
75 | * |
||
76 | * @var array |
||
77 | */ |
||
78 | public $display_configuration = []; |
||
79 | |||
80 | /** |
||
81 | * Display lazy plugin collection. |
||
82 | * |
||
83 | * @var \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
84 | */ |
||
85 | protected $displayCollection; |
||
86 | |||
87 | /** |
||
88 | * The array of widgets for this entity browser. |
||
89 | * |
||
90 | * @var array |
||
91 | */ |
||
92 | protected $widgets; |
||
93 | |||
94 | /** |
||
95 | * Holds the collection of widgets that are used by this entity browser. |
||
96 | * |
||
97 | * @var \Drupal\entity_browser\WidgetsCollection |
||
98 | */ |
||
99 | protected $widgetsCollection; |
||
100 | |||
101 | /** |
||
102 | * The selection display plugin ID. |
||
103 | * |
||
104 | * @var string |
||
105 | */ |
||
106 | public $selection_display; |
||
107 | |||
108 | /** |
||
109 | * The selection display plugin configuration. |
||
110 | * |
||
111 | * @var array |
||
112 | */ |
||
113 | public $selection_display_configuration = []; |
||
114 | |||
115 | /** |
||
116 | * Selection display plugin collection. |
||
117 | * |
||
118 | * @var \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
119 | */ |
||
120 | protected $selectionDisplayCollection; |
||
121 | |||
122 | /** |
||
123 | * The widget selector plugin ID. |
||
124 | * |
||
125 | * @var string |
||
126 | */ |
||
127 | public $widget_selector; |
||
128 | |||
129 | /** |
||
130 | * The widget selector plugin configuration. |
||
131 | * |
||
132 | * @var array |
||
133 | */ |
||
134 | public $widget_selector_configuration = []; |
||
135 | |||
136 | /** |
||
137 | * Widget selector plugin collection. |
||
138 | * |
||
139 | * @var \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
140 | */ |
||
141 | protected $widgetSelectorCollection; |
||
142 | |||
143 | /** |
||
144 | * Additional widget parameters. |
||
145 | * |
||
146 | * @var array |
||
147 | */ |
||
148 | protected $additional_widget_parameters = []; |
||
149 | |||
150 | /** |
||
151 | * Name of the form class. |
||
152 | * |
||
153 | * @var string |
||
154 | */ |
||
155 | protected $form_class = '\Drupal\entity_browser\Form\EntityBrowserForm'; |
||
156 | |||
157 | /** |
||
158 | * {@inheritdoc} |
||
159 | */ |
||
160 | public function id() { |
||
163 | |||
164 | /** |
||
165 | * {@inheritdoc} |
||
166 | */ |
||
167 | public function getName() { |
||
170 | |||
171 | /** |
||
172 | * {@inheritdoc} |
||
173 | */ |
||
174 | public function setName($name) { |
||
178 | |||
179 | /** |
||
180 | * {@inheritdoc} |
||
181 | */ |
||
182 | public function getDisplay() { |
||
185 | |||
186 | /** |
||
187 | * Returns display plugin collection. |
||
188 | * |
||
189 | * @return \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
190 | * The tag plugin collection. |
||
191 | */ |
||
192 | protected function displayPluginCollection() { |
||
199 | |||
200 | /** |
||
201 | * Returns the plugin collections used by this entity. |
||
202 | * |
||
203 | * @return \Drupal\Component\Plugin\LazyPluginCollection[] |
||
204 | * An array of plugin collections, keyed by the property name they use to |
||
205 | * store their configuration. |
||
206 | */ |
||
207 | public function getPluginCollections() { |
||
215 | |||
216 | /** |
||
217 | * {@inheritdoc} |
||
218 | */ |
||
219 | public function getWidget($widget) { |
||
222 | |||
223 | /** |
||
224 | * {@inheritdoc} |
||
225 | */ |
||
226 | public function getWidgets() { |
||
236 | |||
237 | /** |
||
238 | * {@inheritdoc} |
||
239 | */ |
||
240 | public function addWidget(array $configuration) { |
||
245 | |||
246 | /** |
||
247 | * {@inheritdoc} |
||
248 | */ |
||
249 | public function deleteWidget(WidgetInterface $widget) { |
||
254 | |||
255 | /** |
||
256 | * {@inheritdoc} |
||
257 | */ |
||
258 | public function getFirstWidget() { |
||
262 | |||
263 | /** |
||
264 | * {@inheritdoc} |
||
265 | */ |
||
266 | public function addAdditionalWidgetParameters(array $parameters) { |
||
271 | |||
272 | /** |
||
273 | * {@inheritdoc} |
||
274 | */ |
||
275 | public function getAdditionalWidgetParameters() { |
||
279 | |||
280 | /** |
||
281 | * Returns selection display plugin collection. |
||
282 | * |
||
283 | * @return \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
284 | * The tag plugin collection. |
||
285 | */ |
||
286 | protected function selectionDisplayPluginCollection() { |
||
293 | |||
294 | /** |
||
295 | * {@inheritdoc} |
||
296 | */ |
||
297 | public function getSelectionDisplay() { |
||
300 | |||
301 | /** |
||
302 | * Returns widget selector plugin collection. |
||
303 | * |
||
304 | * @return \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
305 | * The tag plugin collection. |
||
306 | */ |
||
307 | protected function widgetSelectorPluginCollection() { |
||
318 | |||
319 | /** |
||
320 | * {@inheritdoc} |
||
321 | */ |
||
322 | public function getWidgetSelector() { |
||
325 | |||
326 | /** |
||
327 | * {@inheritdoc} |
||
328 | */ |
||
329 | public function route() { |
||
349 | |||
350 | /** |
||
351 | * {@inheritdoc} |
||
352 | */ |
||
353 | public function preSave(EntityStorageInterface $storage) { |
||
365 | |||
366 | /** |
||
367 | * Prevent plugin collections from being serialized and correctly serialize |
||
368 | * selected entities. |
||
369 | */ |
||
370 | public function __sleep() { |
||
388 | |||
389 | /** |
||
390 | * {@inheritdoc} |
||
391 | */ |
||
392 | public function save() { |
||
399 | |||
400 | /** |
||
401 | * {@inheritdoc} |
||
402 | */ |
||
403 | public function getFormObject() { |
||
408 | |||
409 | } |
||
410 |