public function BehaviorSettings::calculateDependencies in Rabbit Hole 8
Same name and namespace in other branches
- 2.x src/Entity/BehaviorSettings.php \Drupal\rabbit_hole\Entity\BehaviorSettings::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/ BehaviorSettings.php, line 192
Class
- BehaviorSettings
- Defines the Behavior settings entity.
Namespace
Drupal\rabbit_hole\EntityCode
public function calculateDependencies() {
parent::calculateDependencies();
if ($this->entity_type_id && $this->entity_id) {
// Create dependency on the bundle.
$bundle = \Drupal::entityTypeManager()
->getDefinition($this->entity_type_id);
$entity_type = \Drupal::entityTypeManager()
->getDefinition($bundle
->getBundleOf());
$bundle_config_dependency = $entity_type
->getBundleConfigDependency($this->entity_id);
$this
->addDependency($bundle_config_dependency['type'], $bundle_config_dependency['name']);
}
return $this;
}