1 | <?php |
||
18 | class EntityBrowserForm extends FormBase implements EntityBrowserFormInterface { |
||
19 | |||
20 | /** |
||
21 | * UUID generator service. |
||
22 | * |
||
23 | * @var \Drupal\Component\Uuid\UuidInterface |
||
24 | */ |
||
25 | protected $uuidGenerator; |
||
26 | |||
27 | /** |
||
28 | * The entity browser object. |
||
29 | * |
||
30 | * @var \Drupal\entity_browser\EntityBrowserInterface |
||
31 | */ |
||
32 | protected $entity_browser; |
||
33 | |||
34 | /** |
||
35 | * The entity browser selection storage. |
||
36 | * |
||
37 | * @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface |
||
38 | */ |
||
39 | protected $selectionStorage; |
||
40 | |||
41 | /** |
||
42 | * Constructs a EntityBrowserForm object. |
||
43 | * |
||
44 | * @param \Drupal\Component\Uuid\UuidInterface $uuid_generator |
||
45 | * The UUID generator service. |
||
46 | */ |
||
47 | public function __construct(UuidInterface $uuid_generator, KeyValueStoreExpirableInterface $selection_storage) { |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public static function create(ContainerInterface $container) { |
||
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | public function getFormId() { |
||
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | public function setEntityBrowser(EntityBrowserInterface $entity_browser) { |
||
75 | |||
76 | /** |
||
77 | * Initializes form state. |
||
78 | * |
||
79 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
80 | * Form state object. |
||
81 | */ |
||
82 | protected function init(FormStateInterface $form_state) { |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | public function buildForm(array $form, FormStateInterface $form_state) { |
||
144 | |||
145 | /** |
||
146 | * Check if entity browser with selected configuration combination can work. |
||
147 | * |
||
148 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
149 | * Form status. |
||
150 | */ |
||
151 | protected function isFunctionalForm(FormStateInterface $form_state) { |
||
167 | |||
168 | /** |
||
169 | * {@inheritdoc} |
||
170 | */ |
||
171 | public function validateForm(array &$form, FormStateInterface $form_state) { |
||
176 | |||
177 | /** |
||
178 | * {@inheritdoc} |
||
179 | */ |
||
180 | public function submitForm(array &$form, FormStateInterface $form_state) { |
||
205 | |||
206 | /** |
||
207 | * Returns the widget that is currently selected. |
||
208 | * |
||
209 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
210 | * The current state of the form. |
||
211 | * |
||
212 | * @return string |
||
213 | * ID of currently selected widget. |
||
214 | */ |
||
215 | protected function getCurrentWidget(FormStateInterface $form_state) { |
||
223 | |||
224 | /** |
||
225 | * Sets widget that is currently active. |
||
226 | * |
||
227 | * @param string $widget |
||
228 | * New active widget UUID. |
||
229 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
230 | * Form state. |
||
231 | */ |
||
232 | protected function setCurrentWidget($widget, FormStateInterface $form_state) { |
||
235 | |||
236 | /** |
||
237 | * Indicates selection is done. |
||
238 | * |
||
239 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
240 | * Form state. |
||
241 | * |
||
242 | * @return bool |
||
243 | * Indicates selection is done. |
||
244 | */ |
||
245 | protected function isSelectionCompleted(FormStateInterface $form_state) { |
||
248 | |||
249 | /** |
||
250 | * Returns currently selected entities. |
||
251 | * |
||
252 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
253 | * Form state. |
||
254 | * |
||
255 | * @return \Drupal\Core\Entity\EntityInterface[] |
||
256 | * Array of currently selected entities. |
||
257 | */ |
||
258 | protected function getSelectedEntities(FormStateInterface $form_state) { |
||
261 | |||
262 | } |
||
263 |