function WorkflowTypeBase::setStateLabel

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

Overrides WorkflowTypeInterface::setStateLabel

1 method overrides WorkflowTypeBase::setStateLabel()
PredefinedStatesWorkflowTestType::setStateLabel in core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/PredefinedStatesWorkflowTestType.php
Sets a state's label.

File

core/modules/workflows/src/Plugin/WorkflowTypeBase.php, line 168

Class

WorkflowTypeBase
A base class for Workflow type plugins.

Namespace

Drupal\workflows\Plugin

Code

public function setStateLabel($state_id, $label) {
    if (!$this->hasState($state_id)) {
        throw new \InvalidArgumentException("The state '{$state_id}' does not exist in workflow.");
    }
    $this->configuration['states'][$state_id]['label'] = $label;
    return $this;
}

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