You are here

public function ModerationInformation::getWorkflowForEntityTypeAndBundle in Drupal 10

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

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;
}