public function WorkflowTypeBase::getState in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::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 WorkflowTypeInterface::getState
1 call to WorkflowTypeBase::getState()
- ContentModeration::getState in core/
modules/ content_moderation/ src/ Plugin/ WorkflowType/ ContentModeration.php - Gets a workflow state.
2 methods override WorkflowTypeBase::getState()
- ContentModeration::getState in core/
modules/ content_moderation/ src/ Plugin/ WorkflowType/ ContentModeration.php - Gets a workflow state.
- PredefinedStatesWorkflowTestType::getState in core/
modules/ workflows/ tests/ modules/ workflow_type_test/ src/ Plugin/ WorkflowType/ PredefinedStatesWorkflowTestType.php - Gets a workflow state.
File
- core/
modules/ workflows/ src/ Plugin/ WorkflowTypeBase.php, line 153
Class
- WorkflowTypeBase
- A base class for Workflow type plugins.
Namespace
Drupal\workflows\PluginCode
public function getState($state_id) {
if (!isset($this->configuration['states'][$state_id])) {
throw new \InvalidArgumentException("The state '{$state_id}' does not exist in workflow.");
}
return new State($this, $state_id, $this->configuration['states'][$state_id]['label'], $this->configuration['states'][$state_id]['weight']);
}