public function ContentModeration::getState in Drupal 9
Same name and namespace in other branches
- 8 core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php \Drupal\content_moderation\Plugin\WorkflowType\ContentModeration::getState()
Gets a workflow state.
Parameters
string $state_id: The state's ID.
Return value
\Drupal\workflows\StateInterface The workflow state.
Throws
\InvalidArgumentException Thrown if $state_id does not exist.
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 99
Class
- ContentModeration
- Attaches workflows to content entity types and their bundles.
Namespace
Drupal\content_moderation\Plugin\WorkflowTypeCode
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;
}