public function RngEventType::calculateDependencies in RNG - Events and Registrations 8.2
Same name and namespace in other branches
- 3.x src/Entity/RngEventType.php \Drupal\rng\Entity\RngEventType::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/ RngEventType.php, line 506
Class
- RngEventType
- Defines the event type entity.
Namespace
Drupal\rng\EntityCode
public function calculateDependencies() {
parent::calculateDependencies();
// Event entity type/bundle.
$entity_type = \Drupal::entityTypeManager()
->getDefinition($this
->getEventEntityTypeId());
if ($entity_type) {
$bundle_entity_type = $entity_type
->getBundleEntityType();
if ($bundle_entity_type && $bundle_entity_type !== 'bundle') {
$bundle = \Drupal::entityTypeManager()
->getStorage($entity_type
->getBundleEntityType())
->load($this
->getEventBundle());
if ($bundle) {
$this
->addDependency('config', $bundle
->getConfigDependencyName());
}
}
else {
$this
->addDependency('module', $entity_type
->getProvider());
}
}
// Default registrant type.
$registrant_type_id = $this
->getDefaultRegistrantType();
if ($registrant_type_id) {
$registrant_type = RegistrantType::load($registrant_type_id);
if ($registrant_type) {
$this
->addDependency('config', $registrant_type
->getConfigDependencyName());
}
}
return $this;
}