N°9861 - Changes from review

This commit is contained in:
lenaick.moreira
2026-08-05 17:37:29 +02:00
parent 1dd44e53c4
commit cfcad3b39a
2 changed files with 24 additions and 11 deletions

View File

@@ -59,7 +59,7 @@ class WizardController
* Removes information about the previous step from the stack
* @return array{'class': string, 'state': string}
*/
protected function PopStep(): array
public function PopStep(): array
{
$aStep = array_pop($this->aWizardSteps);
$this->SetParameter('_steps', $this->aWizardSteps);
@@ -335,4 +335,21 @@ EOF
{
$this->oSessionParameters->Erase();
}
/**
* @param string $sStepClass The class name of the step to find the latest state for
*
* @return WizardState
*/
public function GetLatestWizardStateFromStepClass(string $sStepClass, bool $bPopStep = true): WizardState
{
$iCountModulesChoiceSteps = count(array_filter($this->aWizardSteps, fn (array $step): bool => $step['class'] === $sStepClass && $step['state'] !== ''));
$sStepState = $iCountModulesChoiceSteps > 0 ? (string) ($iCountModulesChoiceSteps - 1) : '';
if ($bPopStep) {
$this->PopStep();
}
return new WizardState($sStepClass, $sStepState);
}
}