public function EntityBundle::evaluate in Drupal 9
Same name and namespace in other branches
- 10 core/lib/Drupal/Core/Entity/Plugin/Condition/EntityBundle.php \Drupal\Core\Entity\Plugin\Condition\EntityBundle::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/
lib/ Drupal/ Core/ Entity/ Plugin/ Condition/ EntityBundle.php, line 85
Class
- EntityBundle
- Provides the 'Entity Bundle' condition.
Namespace
Drupal\Core\Entity\Plugin\ConditionCode
public function evaluate() {
// Returns true if no bundles are selected and negate option is disabled.
if (empty($this->configuration['bundles']) && !$this
->isNegated()) {
return TRUE;
}
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = $this
->getContextValue($this
->getDerivativeId());
return !empty($this->configuration['bundles'][$entity
->bundle()]);
}