You are here

public function Template::calculateDependencies in Workbench Email 8

Same name and namespace in other branches
  1. 2.x src/Entity/Template.php \Drupal\workbench_email\Entity\Template::calculateDependencies()

Calculates dependencies and stores them in the dependency property.

Return value

$this

Overrides ConfigEntityBase::calculateDependencies

See also

\Drupal\Core\Config\Entity\ConfigDependencyManager

File

src/Entity/Template.php, line 191

Class

Template
Defines the Email Template entity.

Namespace

Drupal\workbench_email\Entity

Code

public function calculateDependencies() {
  parent::calculateDependencies();
  foreach ($this->bundles as $bundle) {
    list($entity_type_id, $bundle_id) = explode(':', $bundle, 2);
    $entity_type = \Drupal::entityTypeManager()
      ->getDefinition($entity_type_id);
    $bundle_config_dependency = $entity_type
      ->getBundleConfigDependency($bundle_id);
    $this
      ->addDependency($bundle_config_dependency['type'], $bundle_config_dependency['name']);
  }
  return $this;
}