function Entity::calculateDependencies

Overrides HandlerBase::calculateDependencies

File

core/modules/views/src/Plugin/views/area/Entity.php, line 207

Class

Entity
Provides an area handler which renders an entity in a certain view mode.

Namespace

Drupal\views\Plugin\views\area

Code

public function calculateDependencies() {
  $dependencies = parent::calculateDependencies();
  // Ensure that we don't add dependencies for placeholders.
  // @todo Use a method to check for tokens in
  //   https://www.drupal.org/node/2396607.
  if (!str_contains($this->options['target'], '{{')) {
    if ($entity = $this->entityRepository
      ->loadEntityByConfigTarget($this->entityType, $this->options['target'])) {
      $dependencies[$this->entityTypeManager
        ->getDefinition($this->entityType)
        ->getConfigDependencyKey()][] = $entity->getConfigDependencyName();
    }
  }
  return $dependencies;
}

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