public function FormsSteps::getStep in Forms Steps 8
Gets a forms_steps step.
Parameters
string $step_id: The step's ID.
Return value
\Drupal\forms_steps\StepInterface The forms_steps step.
Throws
\InvalidArgumentException Thrown if $step_id does not exist.
Overrides FormsStepsInterface::getStep
File
- src/
Entity/ FormsSteps.php, line 423
Class
- FormsSteps
- FormsSteps configuration entity to persistently store configuration.
Namespace
Drupal\forms_steps\EntityCode
public function getStep($step_id) {
if (!isset($this->steps[$step_id])) {
throw new \InvalidArgumentException("The Step '{$step_id}' does not exist in forms steps '{$this->id()}'");
}
$step = new Step($this, $step_id, $this->steps[$step_id]['label'], $this->steps[$step_id]['weight'], $this->steps[$step_id]['entity_type'], $this->steps[$step_id]['entity_bundle'], $this->steps[$step_id]['form_mode'], $this->steps[$step_id]['url']);
if (isset($this->steps[$step_id]['cancelStepMode'])) {
$step
->setCancelStepMode($this->steps[$step_id]['cancelStepMode']);
}
if (isset($this->steps[$step_id]['cancelRoute'])) {
$step
->setCancelRoute($this->steps[$step_id]['cancelRoute']);
}
if (isset($this->steps[$step_id]['submitLabel'])) {
$step
->setSubmitLabel($this->steps[$step_id]['submitLabel']);
}
if (isset($this->steps[$step_id]['cancelLabel'])) {
$step
->setCancelLabel($this->steps[$step_id]['cancelLabel']);
}
if (isset($this->steps[$step_id]['cancelStep'])) {
$step
->setCancelStep($this
->getStep($this->steps[$step_id]['cancelStep']));
}
if (isset($this->steps[$step_id]['hideDelete'])) {
$step
->setHideDelete($this->steps[$step_id]['hideDelete']);
}
if (isset($this->steps[$step_id]['deleteLabel']) && (!isset($this->steps[$step_id]['hideDelete']) || !$this->steps[$step_id]['hideDelete'])) {
$step
->setDeleteLabel($this->steps[$step_id]['deleteLabel']);
}
if (isset($this->steps[$step_id]['displayPrevious'])) {
$step
->setDisplayPrevious($this->steps[$step_id]['displayPrevious']);
}
if (isset($this->steps[$step_id]['previousLabel'])) {
$step
->setPreviousLabel($this->steps[$step_id]['previousLabel']);
}
return $step;
}