src/WasabiLib/Wizard/Wizard.php
private function initStepViewModel() {
        #first start of Wizard
        #load template from first step
        $currentStep = $this->stepCollectionIterator->current();
        $isFirstStep = $this->getSteps()->isFirst($currentStep);
        if ($isFirstStep) {
            $firstStep = $this->getSteps()->getFirst();
            $this->viewModel->addChild($firstStep->getViewModel(), "wizardContent");
            $firstStepFormName = $firstStep->getViewModel()->getVariable("formName", false);
            if (empty($firstStepFormName))
                throw new \Exception("viewModel variable 'formName' must set for Step '".$firstStep->getName()."'");
        }
        if (!($this->prevButtonDisabled && $isFirstStep)) {
            $this->prevButtonViewModel = new ViewModel();
            $this->prevButtonViewModel->setTemplate("wizard/wizardButton");
            $this->prevButtonViewModel->setVariable("stepActionDirection", "prev");
            $this->prevButtonViewModel->setVariable("id", "prevButton");
        }

        $this->nextButtonViewModel = new ViewModel();
        $this->nextButtonViewModel->setTemplate("wizard/wizardButton");
        $this->nextButtonViewModel->setVariable("stepActionDirection", "next");
        $this->nextButtonViewModel->setVariable("id", "nextButton");

        /**
         * creates breadcrumbPath
         */
        $stepIterator = $this->getSteps()->getIterator();
        while ($stepIterator->valid()) {
            $view = $this->createBreadcrumbItems($stepIterator->current());
            $this->getSteps()->isFirst($stepIterator->current()) ? $view->setVariable("extendCssClass", "active first") : false;
            $this->getSteps()->isLast($stepIterator->current()) ? $view->setVariable("extendCssClass", "last") : false;
            $view->setVariable("breadcrumbStepName", $stepIterator->current()->getName());
            $this->viewModel->addChild($view, "breadcrumbNavigation", true);
            $stepIterator->next();
        }
        $this->resultContent = $this->viewModel;
        $this->process();
    }
private function initStepViewModel() {
        #first start of Wizard
        #load template from first step
        $currentStep = $this->stepCollectionIterator->current();
        $isFirstStep = $this->getSteps()->isFirst($currentStep);
        if ($isFirstStep) {
            $firstStep = $this->getSteps()->getFirst();
            $this->viewModel->addChild($firstStep->getViewModel(), "wizardContent");
            $firstStepFormName = $firstStep->getViewModel()->getVariable("formName", false);
            if (empty($firstStepFormName))
                throw new \Exception("viewModel variable 'formName' must set for Step '".$firstStep->getName()."'");
        }
        if (!($this->prevButtonDisabled && $isFirstStep)) {
            $this->prevButtonViewModel = new ViewModel();
            $this->prevButtonViewModel->setTemplate("wizard/wizardButton");
            $this->prevButtonViewModel->setVariable("stepActionDirection", "prev");
            $this->prevButtonViewModel->setVariable("id", "prevButton");
        }

        $this->nextButtonViewModel = new ViewModel();
        $this->nextButtonViewModel->setTemplate("wizard/wizardButton");
        $this->nextButtonViewModel->setVariable("stepActionDirection", "next");
        $this->nextButtonViewModel->setVariable("id", "nextButton");

        /**
         * creates breadcrumbPath
         */
        $stepIterator = $this->getSteps()->getIterator();
        while ($stepIterator->valid()) {
            $view = $this->createBreadcrumbItems($stepIterator->current());
            $this->getSteps()->isFirst($stepIterator->current()) ? $view->setVariable("extendCssClass", "active first") : false;
            $this->getSteps()->isLast($stepIterator->current()) ? $view->setVariable("extendCssClass", "last") : false;
            $view->setVariable("breadcrumbStepName", $stepIterator->current()->getName());
            $this->viewModel->addChild($view, "breadcrumbNavigation", true);
            $stepIterator->next();
        }
        $this->resultContent = $this->viewModel;
        $this->process();
    }
private function initStepViewModel ( ) { #first start of Wizard #load template from first step $ currentStep = $ this -> stepCollectionIterator -> current ( ) ; $ isFirstStep = $ this -> getSteps ( ) -> isFirst ( $ currentStep ) ; if ( $ isFirstStep ) { $ firstStep = $ this -> getSteps ( ) -> getFirst ( ) ; $ this -> viewModel -> addChild ( $ firstStep -> getViewModel ( ) , "wizardContent" ) ; $ firstStepFormName = $ firstStep -> getViewModel ( ) -> getVariable ( "formName" , false ) ; if ( empty ( $ firstStepFormName ) ) throw new \ Exception ( "viewModel variable 'formName' must set for Step '" . $ firstStep -> getName ( ) . "'" ) ; } if ( ! ( $ this -> prevButtonDisabled && $ isFirstStep ) ) { $ this -> prevButtonViewModel = new ViewModel ( ) ; $ this -> prevButtonViewModel -> setTemplate ( "wizard/wizardButton" ) ; $ this -> prevButtonViewModel -> setVariable ( "stepActionDirection" , "prev" ) ; $ this -> prevButtonViewModel -> setVariable ( "id" , "prevButton" ) ; } $ this -> nextButtonViewModel = new ViewModel ( ) ; $ this -> nextButtonViewModel -> setTemplate ( "wizard/wizardButton" ) ; $ this -> nextButtonViewModel -> setVariable ( "stepActionDirection" , "next" ) ; $ this -> nextButtonViewModel -> setVariable ( "id" , "nextButton" ) ; /**
         * creates breadcrumbPath
         */ $ stepIterator = $ this -> getSteps ( ) -> getIterator ( ) ; while ( $ stepIterator -> valid ( ) ) { $ view = $ this -> createBreadcrumbItems ( $ stepIterator -> current ( ) ) ; $ this -> getSteps ( ) -> isFirst ( $ stepIterator -> current ( ) ) ? $ view -> setVariable ( "extendCssClass" , "active first" ) : false ; $ this -> getSteps ( ) -> isLast ( $ stepIterator -> current ( ) ) ? $ view -> setVariable ( "extendCssClass" , "last" ) : false ; $ view -> setVariable ( "breadcrumbStepName" , $ stepIterator -> current ( ) -> getName ( ) ) ; $ this -> viewModel -> addChild ( $ view , "breadcrumbNavigation" , true ) ; $ stepIterator -> next ( ) ; } $ this -> resultContent = $ this -> viewModel ; $ this -> process ( ) ; }
init the ViewModel for the wizard
@throws \Exception
init the ViewModel for the wizard