function ConditionPluginBase::validateConfigurationForm

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Condition/ConditionPluginBase.php \Drupal\Core\Condition\ConditionPluginBase::validateConfigurationForm()
  2. 10 core/lib/Drupal/Core/Condition/ConditionPluginBase.php \Drupal\Core\Condition\ConditionPluginBase::validateConfigurationForm()
  3. 9 core/lib/Drupal/Core/Condition/ConditionPluginBase.php \Drupal\Core\Condition\ConditionPluginBase::validateConfigurationForm()
  4. 8.9.x core/lib/Drupal/Core/Condition/ConditionPluginBase.php \Drupal\Core\Condition\ConditionPluginBase::validateConfigurationForm()

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 PluginFormInterface::validateConfigurationForm

1 method overrides ConditionPluginBase::validateConfigurationForm()
RequestPath::validateConfigurationForm in core/modules/system/src/Plugin/Condition/RequestPath.php

File

core/lib/Drupal/Core/Condition/ConditionPluginBase.php, line 68

Class

ConditionPluginBase
Provides a basis for fulfilling contexts for condition plugins.

Namespace

Drupal\Core\Condition

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  // In the config schema, 'negate' is a boolean. However, some form elements
  // such as checkbox return the value as 0/1. Cast here to ensure the data is
  // in the expected type.
  $form_state->setValue('negate', (bool) $form_state->getValue('negate'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.