function WorkflowTypeBase::setTransitionLabel

Same name and namespace in other branches
  1. 9 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::setTransitionLabel()
  2. 8.9.x core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::setTransitionLabel()
  3. 10 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

Overrides WorkflowTypeInterface::setTransitionLabel

File

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

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;
}

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