function OptionalContextCondition::evaluate

Same name in other branches
  1. 9 core/modules/system/tests/modules/condition_test/src/Plugin/Condition/OptionalContextCondition.php \Drupal\condition_test\Plugin\Condition\OptionalContextCondition::evaluate()
  2. 10 core/modules/system/tests/modules/condition_test/src/Plugin/Condition/OptionalContextCondition.php \Drupal\condition_test\Plugin\Condition\OptionalContextCondition::evaluate()
  3. 11.x core/modules/system/tests/modules/condition_test/src/Plugin/Condition/OptionalContextCondition.php \Drupal\condition_test\Plugin\Condition\OptionalContextCondition::evaluate()

Overrides ConditionInterface::evaluate

File

core/modules/system/tests/modules/condition_test/src/Plugin/Condition/OptionalContextCondition.php, line 26

Class

OptionalContextCondition
Provides a condition with an optional node context.

Namespace

Drupal\condition_test\Plugin\Condition

Code

public function evaluate() {
    // Grant access if no context value is given.
    return !$this->getContextValue('node');
}

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