You are here

public function EntityBrowserEditForm::validateForm in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Form/EntityBrowserEditForm.php \Drupal\entity_browser\Form\EntityBrowserEditForm::validateForm()

Form validation 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 FormBase::validateForm

File

src/Form/EntityBrowserEditForm.php, line 426

Class

EntityBrowserEditForm
Class EntityBrowserEditForm.

Namespace

Drupal\entity_browser\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {

  // Only validate on form submission.
  if ($form_state
    ->getTriggeringElement()['#name'] !== 'op') {
    return;
  }
  $subform_state = SubformState::createForSubform($form['display_wrapper']['display_configuration'], $form, $form_state);
  $this->entity
    ->getDisplay()
    ->validateConfigurationForm($form['display_wrapper']['display_configuration'], $subform_state);
  $subform_state = SubformState::createForSubform($form['widget_selector_wrapper']['widget_selector_configuration'], $form, $form_state);
  $this->entity
    ->getWidgetSelector()
    ->validateConfigurationForm($form['widget_selector_wrapper']['widget_selector_configuration'], $subform_state);
  $subform_state = SubformState::createForSubform($form['selection_display_wrapper']['selection_display_configuration'], $form, $form_state);
  $this->entity
    ->getSelectionDisplay()
    ->validateConfigurationForm($form['selection_display_wrapper']['selection_display_configuration'], $subform_state);
}