function NodeType::evaluate

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

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

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