function WorkflowTypeBase::getState

Same name and namespace in other branches
  1. 9 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::getState()
  2. 8.9.x core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::getState()
  3. 10 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::getState()

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\Plugin

Code

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']);
}

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