You are here

public function ModerationInformation::getWorkflowForEntityTypeAndBundle in Drupal 8

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

Gets the workflow for the given entity type and bundle.

Parameters

string $entity_type_id: The entity type ID.

string $bundle_id: The entity bundle ID.

Return value

\Drupal\workflows\WorkflowInterface|null The associated workflow. NULL if there is no workflow.

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