You are here

public function Aircraft::submitConfigurationForm in Embed 8

Form submission 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::submitConfigurationForm

File

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

Class

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

Namespace

Drupal\embed_test\Plugin\EmbedType

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('aircraft_type') === 'helicopters') {
    $this
      ->messenger()
      ->addWarning($this
      ->t('Helicopters are just rotorcraft.'));
    $form_state
      ->setValue('aircraft_type', 'rotorcraft');
  }
  parent::submitConfigurationForm($form, $form_state);
}