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) { |
||
163 | |||
164 | /** |
||
165 | * {@inheritdoc} |
||
166 | */ |
||
167 | public function validateForm(array &$form, FormStateInterface $form_state) { |
||
172 | |||
173 | /** |
||
174 | * {@inheritdoc} |
||
175 | */ |
||
176 | public function submitForm(array &$form, FormStateInterface $form_state) { |
||
201 | |||
202 | /** |
||
203 | * Returns the widget that is currently selected. |
||
204 | * |
||
205 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
206 | * The current state of the form. |
||
207 | * |
||
208 | * @return string |
||
209 | * ID of currently selected widget. |
||
210 | */ |
||
211 | protected function getCurrentWidget(FormStateInterface $form_state) { |
||
219 | |||
220 | /** |
||
221 | * Sets widget that is currently active. |
||
222 | * |
||
223 | * @param string $widget |
||
224 | * New active widget UUID. |
||
225 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
226 | * Form state. |
||
227 | */ |
||
228 | protected function setCurrentWidget($widget, FormStateInterface $form_state) { |
||
231 | |||
232 | /** |
||
233 | * Indicates selection is done. |
||
234 | * |
||
235 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
236 | * Form state. |
||
237 | * |
||
238 | * @return bool |
||
239 | * Indicates selection is done. |
||
240 | */ |
||
241 | protected function isSelectionCompleted(FormStateInterface $form_state) { |
||
244 | |||
245 | /** |
||
246 | * Returns currently selected entities. |
||
247 | * |
||
248 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
249 | * Form state. |
||
250 | * |
||
251 | * @return \Drupal\Core\Entity\EntityInterface[] |
||
252 | * Array of currently selected entities. |
||
253 | */ |
||
254 | protected function getSelectedEntities(FormStateInterface $form_state) { |
||
257 | |||
258 | } |
||
259 |