function ConditionPluginBase::buildConfigurationForm

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

Overrides PluginFormInterface::buildConfigurationForm

6 methods override ConditionPluginBase::buildConfigurationForm()
CurrentThemeCondition::buildConfigurationForm in core/modules/system/src/Plugin/Condition/CurrentThemeCondition.php
Form constructor.
EntityBundle::buildConfigurationForm in core/lib/Drupal/Core/Entity/Plugin/Condition/EntityBundle.php
Form constructor.
Language::buildConfigurationForm in core/modules/language/src/Plugin/Condition/Language.php
Form constructor.
RequestPath::buildConfigurationForm in core/modules/system/src/Plugin/Condition/RequestPath.php
Form constructor.
ResponseStatus::buildConfigurationForm in core/modules/system/src/Plugin/Condition/ResponseStatus.php
Form constructor.

... See full list

File

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

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;
}

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