mirror of
https://github.com/Combodo/iTop.git
synced 2026-08-06 13:58:19 +02:00
N°9861 - Changes from review
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user