function ContentModeration::workflowStateHasData

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

Overrides WorkflowTypeBase::workflowStateHasData

File

core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php, line 128

Class

ContentModeration
Attaches workflows to content entity types and their bundles.

Namespace

Drupal\content_moderation\Plugin\WorkflowType

Code

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

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