function WorkflowTypeBase::setTransitionWeight
Same name and namespace in other branches
- 9 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::setTransitionWeight()
- 10 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::setTransitionWeight()
- 11.x core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::setTransitionWeight()
Overrides WorkflowTypeInterface::setTransitionWeight
File
-
core/
modules/ workflows/ src/ Plugin/ WorkflowTypeBase.php, line 395
Class
- WorkflowTypeBase
- A base class for Workflow type plugins.
Namespace
Drupal\workflows\PluginCode
public function setTransitionWeight($transition_id, $weight) {
if (!$this->hasTransition($transition_id)) {
throw new \InvalidArgumentException("The transition '{$transition_id}' does not exist in workflow.");
}
if (!is_numeric($weight)) {
$label = $this->getTransition($transition_id)
->label();
throw new \InvalidArgumentException("The weight '{$weight}' must be numeric for transition '{$label}'.");
}
$this->configuration['transitions'][$transition_id]['weight'] = $weight;
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.