You are here

public function Aircraft::validateConfigurationForm in Embed 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides EmbedTypeBase::validateConfigurationForm

File

tests/embed_test/src/Plugin/EmbedType/Aircraft.php, line 51

Class

Aircraft
An embed type plugin for testing the plugin form. Using aircraft.

Namespace

Drupal\embed_test\Plugin\EmbedType

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('aircraft_type') === 'invalid') {
    $form_state
      ->setError($form['aircraft_type'], $this
      ->t('Cannot select invalid aircraft type.'));
  }
}