You are here

public function TextFormat::validateConfigurationForm in YAML Form 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 YamlFormElementBase::validateConfigurationForm

File

src/Plugin/YamlFormElement/TextFormat.php, line 195

Class

TextFormat
Provides a 'text_format' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  $allowed_formats = $form_state
    ->getValue('allowed_formats');
  $allowed_formats = array_filter($allowed_formats);
  $form_state
    ->setValue('allowed_formats', $allowed_formats);
  parent::validateConfigurationForm($form, $form_state);
}