Skip to content

Commit

Permalink
Unify the way joomla handles alias
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrammatiko committed Sep 21, 2014
1 parent aa895cd commit 3170929
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions administrator/components/com_content/models/article.php
Expand Up @@ -466,6 +466,25 @@ public function save($data)
$data['state'] = 0;
}

// Automatic handling of alias for empty fields
if (in_array($app->input->get('task'), array('apply', 'save', 'save2new')) && (int) $app->input->get('id') == 0)
{
if ($data['alias'] == NULL)
{
if (JFactory::getConfig()->get('unicodeslugs') == 1)
{
$data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['title']);
}
else
{
$data['alias'] = JFilterOutput::stringURLSafe($data['title']);
}
list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']);
$data['alias'] = $alias;
$app->enqueueMessage(JText::_('COM_CONTENT_SAVE_WARNING'), 'warning');
}
}

if (parent::save($data))
{

Expand Down

0 comments on commit 3170929

Please sign in to comment.