function ContentModeration::workflowHasData

Same name in other branches
  1. 8.9.x core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::workflowHasData()
  2. 10 core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::workflowHasData()
  3. 11.x core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::workflowHasData()

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\WorkflowType

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.