public function EntityBrowserForm::submitForm in Entity Browser 8
Same name and namespace in other branches
- 8.2 src/Form/EntityBrowserForm.php \Drupal\entity_browser\Form\EntityBrowserForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ EntityBrowserForm.php, line 227
Class
- EntityBrowserForm
- The entity browser form.
Namespace
Drupal\entity_browser\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$original_widget = $this
->getCurrentWidget($form_state);
if ($new_widget = $this->entityBrowser
->getWidgetSelector()
->submit($form, $form_state)) {
$this
->setCurrentWidget($new_widget, $form_state);
}
// Only call widget submit if we didn't change the widget.
if ($original_widget == $this
->getCurrentWidget($form_state)) {
$this->entityBrowser
->getWidgets()
->get($this
->getCurrentWidget($form_state))
->submit($form[$form['#browser_parts']['widget']], $form, $form_state);
$this->entityBrowser
->getSelectionDisplay()
->submit($form, $form_state);
}
if (!$this
->isSelectionCompleted($form_state)) {
$form_state
->setRebuild();
}
else {
$this->entityBrowser
->getDisplay()
->selectionCompleted($this
->getSelectedEntities($form_state));
}
}