1 | <?php |
||
59 | class EntityBrowser extends ConfigEntityBase implements EntityBrowserInterface, EntityWithPluginCollectionInterface { |
||
60 | |||
61 | /** |
||
62 | * The name of the entity browser. |
||
63 | * |
||
64 | * @var string |
||
65 | */ |
||
66 | public $name; |
||
67 | |||
68 | /** |
||
69 | * The entity browser label. |
||
70 | * |
||
71 | * @var string |
||
72 | */ |
||
73 | public $label; |
||
74 | |||
75 | /** |
||
76 | * The display plugin id. |
||
77 | * |
||
78 | * @var string |
||
79 | */ |
||
80 | public $display; |
||
81 | |||
82 | /** |
||
83 | * The display plugin configuration. |
||
84 | * |
||
85 | * @var array |
||
86 | */ |
||
87 | public $display_configuration = []; |
||
88 | |||
89 | /** |
||
90 | * Display lazy plugin collection. |
||
91 | * |
||
92 | * @var \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
93 | */ |
||
94 | protected $displayCollection; |
||
95 | |||
96 | /** |
||
97 | * Text for the submit button. |
||
98 | * |
||
99 | * @var string |
||
100 | */ |
||
101 | protected $submit_text = 'Select'; |
||
102 | |||
103 | /** |
||
104 | * The array of widgets for this entity browser. |
||
105 | * |
||
106 | * @var array |
||
107 | */ |
||
108 | protected $widgets = []; |
||
109 | |||
110 | /** |
||
111 | * Holds the collection of widgets that are used by this entity browser. |
||
112 | * |
||
113 | * @var \Drupal\entity_browser\WidgetsCollection |
||
114 | */ |
||
115 | protected $widgetsCollection; |
||
116 | |||
117 | /** |
||
118 | * The selection display plugin ID. |
||
119 | * |
||
120 | * @var string |
||
121 | */ |
||
122 | public $selection_display; |
||
123 | |||
124 | /** |
||
125 | * The selection display plugin configuration. |
||
126 | * |
||
127 | * @var array |
||
128 | */ |
||
129 | public $selection_display_configuration = []; |
||
130 | |||
131 | /** |
||
132 | * Selection display plugin collection. |
||
133 | * |
||
134 | * @var \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
135 | */ |
||
136 | protected $selectionDisplayCollection; |
||
137 | |||
138 | /** |
||
139 | * The widget selector plugin ID. |
||
140 | * |
||
141 | * @var string |
||
142 | */ |
||
143 | public $widget_selector; |
||
144 | |||
145 | /** |
||
146 | * The widget selector plugin configuration. |
||
147 | * |
||
148 | * @var array |
||
149 | */ |
||
150 | public $widget_selector_configuration = []; |
||
151 | |||
152 | /** |
||
153 | * Widget selector plugin collection. |
||
154 | * |
||
155 | * @var \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
156 | */ |
||
157 | protected $widgetSelectorCollection; |
||
158 | |||
159 | /** |
||
160 | * Additional widget parameters. |
||
161 | * |
||
162 | * @var array |
||
163 | */ |
||
164 | protected $additional_widget_parameters = []; |
||
165 | |||
166 | /** |
||
167 | * Name of the form class. |
||
168 | * |
||
169 | * @var string |
||
170 | */ |
||
171 | protected $form_class = '\Drupal\entity_browser\Form\EntityBrowserForm'; |
||
172 | |||
173 | /** |
||
174 | * {@inheritdoc} |
||
175 | */ |
||
176 | public function id() { |
||
179 | |||
180 | /** |
||
181 | * {@inheritdoc} |
||
182 | */ |
||
183 | public function getName() { |
||
186 | |||
187 | /** |
||
188 | * {@inheritdoc} |
||
189 | */ |
||
190 | public function setName($name) { |
||
194 | |||
195 | /** |
||
196 | * {@inheritdoc} |
||
197 | */ |
||
198 | public function getDisplay() { |
||
201 | |||
202 | /** |
||
203 | * {@inheritdoc} |
||
204 | */ |
||
205 | public function setLabel($label) { |
||
209 | |||
210 | /** |
||
211 | * {@inheritdoc} |
||
212 | */ |
||
213 | public function setDisplay($display) { |
||
219 | |||
220 | /** |
||
221 | * {@inheritdoc} |
||
222 | */ |
||
223 | public function getSubmitButtonText() { |
||
226 | |||
227 | /** |
||
228 | * {@inheritdoc} |
||
229 | */ |
||
230 | public function setSubmitButtonText($submit_text) { |
||
234 | |||
235 | /** |
||
236 | * {@inheritdoc} |
||
237 | */ |
||
238 | public function setWidgetSelector($widget_selector) { |
||
244 | |||
245 | /** |
||
246 | * {@inheritdoc} |
||
247 | */ |
||
248 | public function setSelectionDisplay($selection_display) { |
||
254 | |||
255 | /** |
||
256 | * Returns display plugin collection. |
||
257 | * |
||
258 | * @return \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
259 | * The tag plugin collection. |
||
260 | */ |
||
261 | protected function displayPluginCollection() { |
||
268 | |||
269 | /** |
||
270 | * Returns the plugin collections used by this entity. |
||
271 | * |
||
272 | * @return \Drupal\Component\Plugin\LazyPluginCollection[] |
||
273 | * An array of plugin collections, keyed by the property name they use to |
||
274 | * store their configuration. |
||
275 | */ |
||
276 | public function getPluginCollections() { |
||
284 | |||
285 | /** |
||
286 | * {@inheritdoc} |
||
287 | */ |
||
288 | public function getWidget($widget) { |
||
291 | |||
292 | /** |
||
293 | * {@inheritdoc} |
||
294 | */ |
||
295 | public function getWidgets() { |
||
305 | |||
306 | /** |
||
307 | * {@inheritdoc} |
||
308 | */ |
||
309 | public function addWidget(array $configuration) { |
||
314 | |||
315 | /** |
||
316 | * {@inheritdoc} |
||
317 | */ |
||
318 | public function deleteWidget(WidgetInterface $widget) { |
||
323 | |||
324 | /** |
||
325 | * {@inheritdoc} |
||
326 | */ |
||
327 | public function getFirstWidget() { |
||
331 | |||
332 | /** |
||
333 | * {@inheritdoc} |
||
334 | */ |
||
335 | public function addAdditionalWidgetParameters(array $parameters) { |
||
340 | |||
341 | /** |
||
342 | * {@inheritdoc} |
||
343 | */ |
||
344 | public function getAdditionalWidgetParameters() { |
||
348 | |||
349 | /** |
||
350 | * Returns selection display plugin collection. |
||
351 | * |
||
352 | * @return \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
353 | * The tag plugin collection. |
||
354 | */ |
||
355 | protected function selectionDisplayPluginCollection() { |
||
362 | |||
363 | /** |
||
364 | * {@inheritdoc} |
||
365 | */ |
||
366 | public function getSelectionDisplay() { |
||
369 | |||
370 | /** |
||
371 | * Returns widget selector plugin collection. |
||
372 | * |
||
373 | * @return \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection |
||
374 | * The tag plugin collection. |
||
375 | */ |
||
376 | protected function widgetSelectorPluginCollection() { |
||
387 | |||
388 | /** |
||
389 | * {@inheritdoc} |
||
390 | */ |
||
391 | public function getWidgetSelector() { |
||
394 | |||
395 | /** |
||
396 | * {@inheritdoc} |
||
397 | */ |
||
398 | public function route() { |
||
418 | |||
419 | /** |
||
420 | * {@inheritdoc} |
||
421 | */ |
||
422 | public function preSave(EntityStorageInterface $storage) { |
||
434 | |||
435 | /** |
||
436 | * Prevent plugin collections from being serialized and correctly serialize |
||
437 | * selected entities. |
||
438 | */ |
||
439 | public function __sleep() { |
||
457 | |||
458 | /** |
||
459 | * {@inheritdoc} |
||
460 | */ |
||
461 | public function save() { |
||
468 | |||
469 | /** |
||
470 | * {@inheritdoc} |
||
471 | */ |
||
472 | public function getFormObject() { |
||
477 | |||
478 | /** |
||
479 | * {@inheritdoc} |
||
480 | */ |
||
481 | protected function urlRouteParameters($rel) { |
||
490 | |||
491 | } |
||
492 |