You are here

public function WorkflowTypeBase::setStateLabel in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::setStateLabel()
  2. 9 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::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;
}