function ContentModeration::calculateDependencies

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::calculateDependencies()
  2. 10 core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::calculateDependencies()
  3. 11.x core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::calculateDependencies()

Overrides WorkflowTypeBase::calculateDependencies

File

core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php, line 234

Class

ContentModeration
Attaches workflows to content entity types and their bundles.

Namespace

Drupal\content_moderation\Plugin\WorkflowType

Code

public function calculateDependencies() {
    $dependencies = parent::calculateDependencies();
    foreach ($this->getEntityTypes() as $entity_type_id) {
        $entity_definition = $this->entityTypeManager
            ->getDefinition($entity_type_id);
        foreach ($this->getBundlesForEntityType($entity_type_id) as $bundle) {
            $dependency = $entity_definition->getBundleConfigDependency($bundle);
            $dependencies[$dependency['type']][] = $dependency['name'];
        }
    }
    return $dependencies;
}

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