You are here

public function EntityExtraFieldForm::validateForm in Entity Extra Field 8

Same name and namespace in other branches
  1. 2.0.x src/Form/EntityExtraFieldForm.php \Drupal\entity_extra_field\Form\EntityExtraFieldForm::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/EntityExtraFieldForm.php, line 200

Class

EntityExtraFieldForm
Define entity extra field form.

Namespace

Drupal\entity_extra_field\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  if ($field_type_id = $form_state
    ->getValue('field_type_id')) {
    $field_type_instance = $this
      ->createFieldTypeInstance($field_type_id, $form_state);
    if ($field_type_instance !== FALSE && $field_type_instance instanceof PluginFormInterface) {
      $subform = [
        '#parents' => [
          'field_type_config',
        ],
      ];
      $field_type_instance
        ->validateConfigurationForm($subform, SubformState::createForSubform($subform, $form, $form_state));
    }
  }
}