You are here

protected function ModerationSidebarController::getModerationState in Moderation Sidebar 8

Gets the Moderation State of a given Entity.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: An entity.

Return value

\Drupal\workflows\StateInterface The moderation state for the given entity.

1 call to ModerationSidebarController::getModerationState()
ModerationSidebarController::getStateLabel in src/Controller/ModerationSidebarController.php
Gets the Moderation State label of a given Entity.

File

src/Controller/ModerationSidebarController.php, line 573

Class

ModerationSidebarController
Endpoints for the Moderation Sidebar module.

Namespace

Drupal\moderation_sidebar\Controller

Code

protected function getModerationState(ContentEntityInterface $entity) {
  $state_id = $entity->moderation_state
    ->get(0)
    ->getValue()['value'];
  $workflow = $this->moderationInformation
    ->getWorkFlowForEntity($entity);
  return $workflow
    ->getTypePlugin()
    ->getState($state_id);
}