public function FormsSteps::setStepUrl in Forms Steps 8
Sets a step's URL value.
Parameters
string $step_id: The step ID to set the URL for.
int $url: The step's URL.
Return value
\Drupal\forms_steps\StepInterface The forms_steps entity.
Overrides FormsStepsInterface::setStepUrl
File
- src/
Entity/ FormsSteps.php, line 563
Class
- FormsSteps
- FormsSteps configuration entity to persistently store configuration.
Namespace
Drupal\forms_steps\EntityCode
public function setStepUrl($step_id, $url) {
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]['url'] = '';
if ('/' != $url[0]) {
$url = '/' . $url;
}
if (!empty(Url::fromUri("internal:{$url}"))) {
$this->steps[$step_id]['url'] = $url;
}
else {
throw new \InvalidArgumentException("The Url Step '{$url}' is not accessible");
}
return $this;
}