function ContentModerationRouteSubscriber::getModeratedEntityTypes

Same name in other branches
  1. 9 core/modules/content_moderation/src/Routing/ContentModerationRouteSubscriber.php \Drupal\content_moderation\Routing\ContentModerationRouteSubscriber::getModeratedEntityTypes()
  2. 8.9.x core/modules/content_moderation/src/Routing/ContentModerationRouteSubscriber.php \Drupal\content_moderation\Routing\ContentModerationRouteSubscriber::getModeratedEntityTypes()
  3. 11.x core/modules/content_moderation/src/Routing/ContentModerationRouteSubscriber.php \Drupal\content_moderation\Routing\ContentModerationRouteSubscriber::getModeratedEntityTypes()

Returns the moderated entity types.

Return value

\Drupal\Core\Entity\ContentEntityTypeInterface[] An associative array of moderated entity types keyed by ID.

File

core/modules/content_moderation/src/Routing/ContentModerationRouteSubscriber.php, line 87

Class

ContentModerationRouteSubscriber
Subscriber for moderated revisionable entity forms.

Namespace

Drupal\content_moderation\Routing

Code

protected function getModeratedEntityTypes() {
    if (!isset($this->moderatedEntityTypes)) {
        $entity_types = $this->entityTypeManager
            ->getDefinitions();
        
        /** @var \Drupal\workflows\WorkflowInterface $workflow */
        foreach (Workflow::loadMultipleByType('content_moderation') as $workflow) {
            
            /** @var \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration $plugin */
            $plugin = $workflow->getTypePlugin();
            foreach ($plugin->getEntityTypes() as $entity_type_id) {
                $this->moderatedEntityTypes[$entity_type_id] = $entity_types[$entity_type_id];
            }
        }
    }
    return $this->moderatedEntityTypes;
}

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