8.5.x NodeType.php NodeType::evaluate()
8.0.x NodeType.php NodeType::evaluate()
8.1.x NodeType.php NodeType::evaluate()
8.2.x NodeType.php NodeType::evaluate()
8.3.x NodeType.php NodeType::evaluate()
8.4.x NodeType.php NodeType::evaluate()
8.6.x NodeType.php 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 106

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()]);
}