You are here

public function Entity::calculateDependencies in Drupal 10

Same name in this branch
  1. 10 core/modules/views/src/Plugin/views/area/Entity.php \Drupal\views\Plugin\views\area\Entity::calculateDependencies()
  2. 10 core/modules/views/src/Plugin/views/argument_validator/Entity.php \Drupal\views\Plugin\views\argument_validator\Entity::calculateDependencies()
  3. 10 core/modules/migrate/src/Plugin/migrate/destination/Entity.php \Drupal\migrate\Plugin\migrate\destination\Entity::calculateDependencies()
Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/argument_validator/Entity.php \Drupal\views\Plugin\views\argument_validator\Entity::calculateDependencies()
  2. 9 core/modules/views/src/Plugin/views/argument_validator/Entity.php \Drupal\views\Plugin\views\argument_validator\Entity::calculateDependencies()
1 call to Entity::calculateDependencies()
User::calculateDependencies in core/modules/user/src/Plugin/views/argument_validator/User.php
1 method overrides Entity::calculateDependencies()
User::calculateDependencies in core/modules/user/src/Plugin/views/argument_validator/User.php

File

core/modules/views/src/Plugin/views/argument_validator/Entity.php, line 234

Class

Entity
Defines an argument validator plugin for each entity type.

Namespace

Drupal\views\Plugin\views\argument_validator

Code

public function calculateDependencies() {
  $dependencies = parent::calculateDependencies();
  $entity_type_id = $this->definition['entity_type'];
  $bundle_entity_type = $this->entityTypeManager
    ->getDefinition($entity_type_id)
    ->getBundleEntityType();

  // The bundle entity type might not exist. For example, users do not have
  // bundles.
  if ($this->entityTypeManager
    ->hasHandler($bundle_entity_type, 'storage')) {
    $bundle_entity_storage = $this->entityTypeManager
      ->getStorage($bundle_entity_type);
    foreach ($bundle_entity_storage
      ->loadMultiple(array_keys($this->options['bundles'])) as $bundle_entity) {
      $dependencies[$bundle_entity
        ->getConfigDependencyKey()][] = $bundle_entity
        ->getConfigDependencyName();
    }
  }
  return $dependencies;
}