You are here

public function WorkflowTypeBase::setTransitionLabel in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::setTransitionLabel()

Sets a transition's label.

Parameters

string $transition_id: The transition ID.

string $label: The transition's label.

Return value

$this

Throws

\InvalidArgumentException Thrown if the transition does not exist.

Overrides WorkflowTypeInterface::setTransitionLabel

File

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

Class

WorkflowTypeBase
A base class for Workflow type plugins.

Namespace

Drupal\workflows\Plugin

Code

public function setTransitionLabel($transition_id, $label) {
  if (!$this
    ->hasTransition($transition_id)) {
    throw new \InvalidArgumentException("The transition '{$transition_id}' does not exist in workflow.");
  }
  $this->configuration['transitions'][$transition_id]['label'] = $label;
  return $this;
}