1 | <?php |
||
16 | class EntityBrowserForm extends FormBase implements EntityBrowserFormInterface { |
||
17 | |||
18 | /** |
||
19 | * UUID generator service. |
||
20 | * |
||
21 | * @var \Drupal\Component\Uuid\UuidInterface |
||
22 | */ |
||
23 | protected $uuidGenerator; |
||
24 | |||
25 | /** |
||
26 | * The entity browser object. |
||
27 | * |
||
28 | * @var \Drupal\entity_browser\EntityBrowserInterface |
||
29 | */ |
||
30 | protected $entity_browser; |
||
31 | |||
32 | /** |
||
33 | * Constructs a EntityBrowserForm object. |
||
34 | * |
||
35 | * @param \Drupal\Component\Uuid\UuidInterface $uuid_generator |
||
36 | * The UUID generator service. |
||
37 | */ |
||
38 | public function __construct(UuidInterface $uuid_generator) { |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public static function create(ContainerInterface $container) { |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | public function getFormId() { |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function setEntityBrowser(EntityBrowserInterface $entity_browser) { |
||
64 | |||
65 | /** |
||
66 | * Initializes form state. |
||
67 | * |
||
68 | * @param \Drupal\Core\Form\FormStateInterface |
||
69 | * Form state object. |
||
70 | */ |
||
71 | protected function init(FormStateInterface $form_state) { |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function buildForm(array $form, FormStateInterface $form_state) { |
||
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | */ |
||
135 | public function validateForm(array &$form, FormStateInterface $form_state) { |
||
140 | |||
141 | /** |
||
142 | * {@inheritdoc} |
||
143 | */ |
||
144 | public function submitForm(array &$form, FormStateInterface $form_state) { |
||
169 | |||
170 | /** |
||
171 | * Returns the widget that is currently selected. |
||
172 | * |
||
173 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
174 | * The current state of the form. |
||
175 | * |
||
176 | * @return string |
||
177 | * ID of currently selected widget. |
||
178 | */ |
||
179 | protected function getCurrentWidget(FormStateInterface $form_state) { |
||
187 | |||
188 | /** |
||
189 | * Sets widget that is currently active. |
||
190 | * |
||
191 | * @param string $widget |
||
192 | * New active widget UUID. |
||
193 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
194 | * Form state. |
||
195 | */ |
||
196 | protected function setCurrentWidget($widget, FormStateInterface $form_state) { |
||
199 | |||
200 | /** |
||
201 | * Indicates selection is done. |
||
202 | * |
||
203 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
204 | * Form state. |
||
205 | * |
||
206 | * @return bool |
||
207 | * Indicates selection is done. |
||
208 | */ |
||
209 | protected function isSelectionCompleted(FormStateInterface $form_state) { |
||
212 | |||
213 | /** |
||
214 | * Returns currently selected entities. |
||
215 | * |
||
216 | * @param \Drupal\Core\Form\FormStateInterface $form_state |
||
217 | * Form state. |
||
218 | * |
||
219 | * @return \Drupal\Core\Entity\EntityInterface[] |
||
220 | * Array of currently selected entities. |
||
221 | */ |
||
222 | protected function getSelectedEntities(FormStateInterface $form_state) { |
||
225 | |||
226 | } |
||
227 |