It is a multistep page's responsibility whether it is shown to the user

refs #6136
This commit is contained in:
Johannes Meyer 2014-05-14 12:44:12 +02:00
parent 754f854dd0
commit ef7bb0e794
2 changed files with 20 additions and 2 deletions

View File

@ -49,6 +49,18 @@ class Page extends Form
} }
/**
* Return whether this page needs to be shown to the user
*
* Overwrite this to add page specific handling
*
* @return bool
*/
public function isRequired()
{
return true;
}
/** /**
* Set the title for this wizard page * Set the title for this wizard page
* *
@ -70,7 +82,7 @@ class Page extends Form
} }
/** /**
* Return a config containing all values of this wizard page * Return a config containing all values provided by the user
* *
* @return Zend_Config * @return Zend_Config
*/ */

View File

@ -8,6 +8,12 @@ use Zend_Config;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
/**
* Multistep form with support for nesting and dynamic behaviour
*
* @todo Pages that were displayed initially and filled out by the user remain
* currently in the configuration returned by Wizard::getConfig()
*/
class Wizard extends Page class Wizard extends Page
{ {
/** /**
@ -31,7 +37,7 @@ class Wizard extends Page
*/ */
public function getPages() public function getPages()
{ {
return $this->pages; return array_filter($this->pages, function ($page) { return $page->isRequired(); });
} }
/** /**