/** * @see Form::validate() */ public function validate() { parent::validate(); if ($this->action == 'modify') { if (empty($_POST['menuItem'])) { throw new UserInputException('menuItem', 'empty'); } else { if (empty($_POST['menuItemLink'])) { throw new UserInputException('menuItemLink', 'empty'); } else { if (!empty($_POST['showOrder']) && !preg_match('/^\\d+$/', $_POST['showOrder'])) { throw new UserInputException('showOrder', 'empty'); } else { if (!AdminTools::validateLinkExists($this->menuItemID, $this->linkCur['menuItem'])) { throw new UserInputException('menuItem', 'exists'); } } } } } }