Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityBundle.php

function EntityBundle::evaluate

Overrides ConditionInterface::evaluate

File

core/lib/Drupal/Core/Entity/Plugin/Condition/EntityBundle.php, line 86

Class

EntityBundle
Provides the 'Entity Bundle' condition.

Namespace

Drupal\Core\Entity\Plugin\Condition

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal