public function ModerationInformation::getWorkflowForEntity in Config Entity Revisions 8.2
Gets the workflow for the given content entity.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The content entity to get the workflow for.
Return value
\Drupal\workflows\WorkflowInterface|null The workflow entity. NULL if there is no workflow.
Overrides ModerationInformation::getWorkflowForEntity
2 calls to ModerationInformation::getWorkflowForEntity()
- ModerationInformation::isDefaultRevisionPublished in src/
ModerationInformation.php - Determines if the default revision for the given entity is published.
- ModerationInformation::isLiveRevision in src/
ModerationInformation.php - Determines if an entity is "live".
File
- src/
ModerationInformation.php, line 228
Class
- ModerationInformation
- Class ModerationInformation.
Namespace
Drupal\config_entity_revisionsCode
public function getWorkflowForEntity(ContentEntityInterface $entity) {
$bundles = $this->bundleInfo
->getBundleInfo($entity
->getEntityTypeId());
if (isset($bundles[$entity
->bundle()]['workflow'])) {
return $this->entityTypeManager
->getStorage('workflow')
->load($bundles[$entity
->bundle()]['workflow']);
}
return NULL;
}