You are here

public function Webform::validateConfigurationForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/Condition/Webform.php \Drupal\webform\Plugin\Condition\Webform::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 ConditionPluginBase::validateConfigurationForm

File

src/Plugin/Condition/Webform.php, line 91

Class

Webform
Provides a 'Webform' condition.

Namespace

Drupal\webform\Plugin\Condition

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  if (!empty($values['webforms']) && empty(array_filter($values['context_mapping']))) {
    $form_state
      ->setErrorByName('webforms', $this
      ->t('Please select which entity should be used to determine the current webform.'));
  }
}