Skip to content

Commit

Permalink
Add layout to com_content links
Browse files Browse the repository at this point in the history
  • Loading branch information
Septdir committed Apr 24, 2018
1 parent 01e6786 commit 35f8ac0
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions components/com_content/helpers/route.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ abstract class ContentHelperRoute
* @param integer $id The route of the content item.
* @param integer $catid The category ID.
* @param integer $language The language code.
* @param string $layout The layout value.
*
* @return string The article route.
*
* @since 1.5
*/
public static function getArticleRoute($id, $catid = 0, $language = 0)
public static function getArticleRoute($id, $catid = 0, $language = 0, $layout = null)
{
// Create the link
$link = 'index.php?option=com_content&view=article&id=' . $id;
Expand All @@ -42,6 +43,11 @@ public static function getArticleRoute($id, $catid = 0, $language = 0)
$link .= '&lang=' . $language;
}

if ($layout)
{
$link .= '&layout=' . $layout;
}

return $link;
}

Expand All @@ -50,12 +56,13 @@ public static function getArticleRoute($id, $catid = 0, $language = 0)
*
* @param integer $catid The category ID.
* @param integer $language The language code.
* @param string $layout TThe layout value.
*
* @return string The article route.
*
* @since 1.5
*/
public static function getCategoryRoute($catid, $language = 0)
public static function getCategoryRoute($catid, $language = 0, $layout = null)
{
if ($catid instanceof JCategoryNode)
{
Expand All @@ -68,16 +75,19 @@ public static function getCategoryRoute($catid, $language = 0)

if ($id < 1)
{
$link = '';
return '';
}
else

$link = 'index.php?option=com_content&view=category&id=' . $id;

if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link = 'index.php?option=com_content&view=category&id=' . $id;
$link .= '&lang=' . $language;
}

if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
if ($layout)
{
$link .= '&layout=' . $layout;
}

return $link;
Expand Down

0 comments on commit 35f8ac0

Please sign in to comment.