function ModerationInformation::getWorkflowForEntityTypeAndBundle

Same name in other branches
  1. 9 core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::getWorkflowForEntityTypeAndBundle()
  2. 8.9.x core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::getWorkflowForEntityTypeAndBundle()
  3. 10 core/modules/content_moderation/src/ModerationInformation.php \Drupal\content_moderation\ModerationInformation::getWorkflowForEntityTypeAndBundle()
1 call to ModerationInformation::getWorkflowForEntityTypeAndBundle()
ModerationInformation::getWorkflowForEntity in core/modules/content_moderation/src/ModerationInformation.php

File

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

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.