public function ContentModeration::workflowStateHasData 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::workflowStateHasData()
Determines if the workflow state 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.
\Drupal\workflows\StateInterface $state: The workflow state to check.
Return value
bool TRUE if the workflow state is being used, FALSE if not.
Overrides WorkflowTypeBase::workflowStateHasData
File
- core/
modules/ content_moderation/ src/ Plugin/ WorkflowType/ ContentModeration.php, line 127
Class
- ContentModeration
- Attaches workflows to content entity types and their bundles.
Namespace
Drupal\content_moderation\Plugin\WorkflowTypeCode
public function workflowStateHasData(WorkflowInterface $workflow, StateInterface $state) {
return (bool) $this->entityTypeManager
->getStorage('content_moderation_state')
->getQuery()
->condition('workflow', $workflow
->id())
->condition('moderation_state', $state
->id())
->count()
->accessCheck(FALSE)
->range(0, 1)
->execute();
}