You are here

public function NodeType::evaluate in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/node/src/Plugin/Condition/NodeType.php \Drupal\node\Plugin\Condition\NodeType::evaluate()

Evaluates the condition and returns TRUE or FALSE accordingly.

Return value

bool TRUE if the condition has been met, FALSE otherwise.

Overrides ConditionInterface::evaluate

File

core/modules/node/src/Plugin/Condition/NodeType.php, line 112

Class

NodeType
Provides a 'Node Type' condition.

Namespace

Drupal\node\Plugin\Condition

Code

public function evaluate() {
  if (empty($this->configuration['bundles']) && !$this
    ->isNegated()) {
    return TRUE;
  }
  $node = $this
    ->getContextValue('node');
  return !empty($this->configuration['bundles'][$node
    ->getType()]);
}