Back to AdminModel class

Method generateNewTitle

protected array
generateNewTitle
(mixed $categoryId, mixed $alias, mixed $title)
Method to change the title & alias.
Parameters
  • int $categoryId The id of the category.
  • string $alias The alias.
  • string $title The title.
Returns
  • array Contains the modified title and alias.
Since
  • 1.7
Class: AdminModel
Project: Joomla

Method generateNewTitle - Source code

/**
 * Method to change the title & alias.
 *
 * @param   integer  $categoryId  The id of the category.
 * @param   string   $alias       The alias.
 * @param   string   $title       The title.
 *
 * @return	array  Contains the modified title and alias.
 *
 * @since	1.7
 */
protected function generateNewTitle($categoryId, $alias, $title)
{
    // Alter the title & alias
    $table = $this->getTable();
    $aliasField = $table->getColumnAlias('alias');
    $catidField = $table->getColumnAlias('catid');
    $titleField = $table->getColumnAlias('title');
    while ($table->load(array($aliasField => $alias, $catidField => $categoryId))) {
        if ($title === $table->{$titleField}) {
            $title = StringHelper::increment($title);
        }
        $alias = StringHelper::increment($alias, 'dash');
    }
    return array($title, $alias);
}