Skip to content

Commit

Permalink
[com_content] - archived legacy SEF fix (joomla#19397)
Browse files Browse the repository at this point in the history
* [com_content] - archived legacy sef fix

* cs
  • Loading branch information
alikon authored and mbabker committed Jan 23, 2018
1 parent cfda73d commit 01a9147
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions components/com_content/helpers/legacyrouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function build(&$query, &$segments)
}
}

if (isset($query['year']) && isset($query['month']))
if (isset($query['month']))
{
if ($menuItemGiven)
{
Expand Down Expand Up @@ -384,7 +384,7 @@ public function parse(&$segments, &$vars)
* because the first segment will have the target category id prepended to it. If the
* last segment has a number prepended, it is an article, otherwise, it is a category.
*/
if (!$advanced)
if ((!$advanced) && ($item->query['view'] !== 'archive'))
{
$cat_id = (int) $segments[0];

Expand All @@ -405,6 +405,16 @@ public function parse(&$segments, &$vars)
return;
}

// Manage the archive view
if ($item->query['view'] == 'archive' && $count !== 1)
{
$vars['year'] = $count >= 2 ? $segments[$count - 2] : null;
$vars['month'] = $segments[$count - 1];
$vars['view'] = 'archive';

return;
}

// We get the category id from the menu item and search from there
$id = $item->query['id'];
$category = JCategories::getInstance('Content')->get($id);
Expand Down Expand Up @@ -456,18 +466,8 @@ public function parse(&$segments, &$vars)
$cid = $segment;
}

$vars['id'] = $cid;

if ($item->query['view'] == 'archive' && $count != 1)
{
$vars['year'] = $count >= 2 ? $segments[$count - 2] : null;
$vars['month'] = $segments[$count - 1];
$vars['view'] = 'archive';
}
else
{
$vars['view'] = 'article';
}
$vars['id'] = $cid;
$vars['view'] = 'article';
}

$found = 0;
Expand Down

0 comments on commit 01a9147

Please sign in to comment.