diff --git a/library/Icinga/Web/Wizard/Page.php b/library/Icinga/Web/Wizard/Page.php index fdc0fd171..82e064745 100644 --- a/library/Icinga/Web/Wizard/Page.php +++ b/library/Icinga/Web/Wizard/Page.php @@ -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 * @@ -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 */ diff --git a/library/Icinga/Web/Wizard/Wizard.php b/library/Icinga/Web/Wizard/Wizard.php index 64e9e5f24..3fc5fa49d 100644 --- a/library/Icinga/Web/Wizard/Wizard.php +++ b/library/Icinga/Web/Wizard/Wizard.php @@ -8,6 +8,12 @@ use Zend_Config; use Icinga\Web\Form; 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 { /** @@ -31,7 +37,7 @@ class Wizard extends Page */ public function getPages() { - return $this->pages; + return array_filter($this->pages, function ($page) { return $page->isRequired(); }); } /**