<?php
/**
 * @package     Joomla.Site
 * @subpackage  Layout
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('JPATH_BASE') or die;
$item = $displayData['item'];
$filterID = $displayData['filterID'];
$title = $this->escape($item->category_title);
if (!isset($item->catslug)) {
	$item->catslug = $item->category_alias ? ($item->catid.':'.$item->category_alias) : $item->catid;
}

$catLink = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catslug));
if($filterID) {
	$catLink = JRoute::_("index.php?Itemid={$filterID}#attr.cat.value={$item->catid}");
}

?>

<?php if ($displayData['params']->get('link_category') && $item->catslug) : ?>
	<a href="<?php echo $catLink; ?>">
		<span class="title"><?php echo $title; ?></span>
	</a>
<?php endif; ?>