You are here

public function FormsSteps::setStepWeight in Forms Steps 8

Sets a step's weight value.

Parameters

string $step_id: The step ID to set the weight for.

int $weight: The step's weight.

Return value

\Drupal\forms_steps\StepInterface The forms_steps entity.

Overrides FormsStepsInterface::setStepWeight

File

src/Entity/FormsSteps.php, line 524

Class

FormsSteps
FormsSteps configuration entity to persistently store configuration.

Namespace

Drupal\forms_steps\Entity

Code

public function setStepWeight($step_id, $weight) {
  if (!isset($this->steps[$step_id])) {
    throw new \InvalidArgumentException("The Step '{$step_id}' does not exist in forms steps '{$this->id()}'");
  }
  $this->steps[$step_id]['weight'] = $weight;
  return $this;
}