Beispiel #1
0
 /**
  * @see \cms\acp\form\PageAddForm::validateAlias()
  */
 protected function validateAlias()
 {
     if (empty($this->alias)) {
         throw new UserInputException('alias');
     }
     if (!PageUtil::isValidAlias($this->alias)) {
         throw new UserInputException('alias', 'notValid');
     }
     if (!PageUtil::isAvailableAlias($this->alias, $this->parentID ?: null, $this->pageID)) {
         throw new UserInputException('alias', 'notUnique');
     }
 }
Beispiel #2
0
 /**
  * Validates the alias.
  */
 protected function validateAlias()
 {
     // build alias automatically
     if (empty($this->alias)) {
         $titles = I18nHandler::getInstance()->getValues('title');
         // prefer english aliases, otherwise use default language
         $language = LanguageFactory::getInstance()->getLanguageByCode('en');
         if ($language === null) {
             $language = LanguageFactory::getInstance()->getLanguage(LanguageFactory::getInstance()->getDefaultLanguageID());
         }
         $this->alias = PageUtil::buildAlias($titles[$language->languageID]);
     }
     if (!PageUtil::isValidAlias($this->alias)) {
         throw new UserInputException('alias', 'notValid');
     }
     if (!PageUtil::isAvailableAlias($this->alias, $this->parentID ?: null)) {
         throw new UserInputException('alias', 'notUnique');
     }
 }