public function FormsSteps::deleteStep in Forms Steps 8
Deletes a step from the forms_steps.
Parameters
string $step_id: The step ID to delete.
Return value
\Drupal\forms_steps\StepInterface The forms_steps entity.
Throws
\InvalidArgumentException Thrown if $step_id does not exist.
Overrides FormsStepsInterface::deleteStep
File
- src/
Entity/ FormsSteps.php, line 746
Class
- FormsSteps
- FormsSteps configuration entity to persistently store configuration.
Namespace
Drupal\forms_steps\EntityCode
public function deleteStep($step_id) {
if (!isset($this->steps[$step_id])) {
throw new \InvalidArgumentException("The step '{$step_id}' does not exist in forms steps '{$this->id()}'");
}
if (count($this->steps) === 1) {
throw new \InvalidArgumentException("The step '{$step_id}' can not be deleted from forms steps '{$this->id()}' as it is the only Step");
}
unset($this->steps[$step_id]);
return $this;
}