public function ContentModeration::workflowHasData in Drupal 9
Same name and namespace in other branches
- 8 core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::workflowHasData()
- 10 core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::workflowHasData()
Determines if the workflow is being has data associated with it.
@internal Marked as internal until it's validated this should form part of the public API in https://www.drupal.org/node/2897148.
Parameters
\Drupal\workflows\WorkflowInterface $workflow: The workflow to check.
Return value
bool TRUE if the workflow is being used, FALSE if not.
Overrides WorkflowTypeBase::workflowHasData
File
- core/
modules/ content_moderation/ src/ Plugin/ WorkflowType/ ContentModeration.php, line 113
Class
- ContentModeration
- Attaches workflows to content entity types and their bundles.
Namespace
Drupal\content_moderation\Plugin\WorkflowTypeCode
public function workflowHasData(WorkflowInterface $workflow) {
return (bool) $this->entityTypeManager
->getStorage('content_moderation_state')
->getQuery()
->condition('workflow', $workflow
->id())
->count()
->accessCheck(FALSE)
->range(0, 1)
->execute();
}