Beispiel #1
0
 /**
  * Verifies no duplicate aliases within a secton's categories listing.
  * Returns true if duplicate detected.
  *
  * @param integer $id the id of the category object
  *
  * @return boolean
  */
 public function uniqueAliasCheck($id = null)
 {
     $alias = $this->get('alias');
     $section = new Section($this->get('section_id'));
     // all categories within a section
     $categories = $section->categories('list');
     // check for duplicate aliases within the same section;
     foreach ($categories as $category) {
         $existing = $category->get('alias');
         if ($alias == $existing && $category->get('id') != $id) {
             $this->setError(Lang::txt('The alias must be unique within a section.'));
             return true;
         } else {
             continue;
         }
     }
     return false;
 }