function ContentModeration::getState

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

Overrides WorkflowTypeBase::getState

1 call to ContentModeration::getState()
ContentModeration::getInitialState in core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php
Gets the initial state for the workflow.

File

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

Class

ContentModeration
Attaches workflows to content entity types and their bundles.

Namespace

Drupal\content_moderation\Plugin\WorkflowType

Code

public function getState($state_id) {
    $state = parent::getState($state_id);
    if (isset($this->configuration['states'][$state->id()]['published']) && isset($this->configuration['states'][$state->id()]['default_revision'])) {
        $state = new ContentModerationState($state, $this->configuration['states'][$state->id()]['published'], $this->configuration['states'][$state->id()]['default_revision']);
    }
    else {
        $state = new ContentModerationState($state);
    }
    return $state;
}

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