You are here

public function ConditionPluginBase::buildConfigurationForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Condition/ConditionPluginBase.php \Drupal\Core\Condition\ConditionPluginBase::buildConfigurationForm()
  2. 9 core/lib/Drupal/Core/Condition/ConditionPluginBase.php \Drupal\Core\Condition\ConditionPluginBase::buildConfigurationForm()

File

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

Class

ConditionPluginBase
Provides a basis for fulfilling contexts for condition plugins.

Namespace

Drupal\Core\Condition

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  if ($form_state instanceof SubformStateInterface) {
    $form_state = $form_state
      ->getCompleteFormState();
  }
  $contexts = $form_state
    ->getTemporaryValue('gathered_contexts') ?: [];
  $form['context_mapping'] = $this
    ->addContextAssignmentElement($this, $contexts);
  $form['negate'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Negate the condition'),
    '#default_value' => $this->configuration['negate'],
  ];
  return $form;
}