function ModerationInformation::getWorkflowForEntityTypeAndBundle

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

Overrides ModerationInformationInterface::getWorkflowForEntityTypeAndBundle

1 call to ModerationInformation::getWorkflowForEntityTypeAndBundle()
ModerationInformation::getWorkflowForEntity in core/modules/content_moderation/src/ModerationInformation.php
Gets the workflow for the given content entity.

File

core/modules/content_moderation/src/ModerationInformation.php, line 218

Class

ModerationInformation
General service for moderation-related questions about Entity API.

Namespace

Drupal\content_moderation

Code

public function getWorkflowForEntityTypeAndBundle($entity_type_id, $bundle_id) {
    $bundles = $this->bundleInfo
        ->getBundleInfo($entity_type_id);
    if (isset($bundles[$bundle_id]['workflow'])) {
        return $this->entityTypeManager
            ->getStorage('workflow')
            ->load($bundles[$bundle_id]['workflow']);
    }
    return NULL;
}

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