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

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\Component\Content\Site\Helper\RouteHelper;

?>
<dd class="category-name tck-article-detail-category">
	<?php if (TCK_ARTICLE_DETAILS_SHOW_ICONS) : ?>
		<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => TCK_ARTICLE_DETAILS_ICON_CATEGORY]); ?>
	<?php endif; ?>
	<?php $title = $this->escape($displayData['item']->category_title); ?>
	<?php if (TCK_ARTICLE_DETAILS_SHOW_LABELS) : ?>
		<?php if ($displayData['params']->get('link_category') && !empty($displayData['item']->catid)) : ?>
			<?php $url = '<a href="' . Route::_(
				RouteHelper::getCategoryRoute($displayData['item']->catid, $displayData['item']->category_language)
				)
				. '" itemprop="genre">' . $title . '</a>'; ?>
			<?php echo Text::sprintf('COM_CONTENT_CATEGORY', $url); ?>
		<?php else : ?>
			<?php echo Text::sprintf('COM_CONTENT_CATEGORY', '<span itemprop="genre">' . $title . '</span>'); ?>
		<?php endif; ?>
	<?php else : ?>
		<?php if ($displayData['params']->get('link_category') && !empty($displayData['item']->catid)) : ?>
			<?php $url = '<a href="' . Route::_(
				RouteHelper::getCategoryRoute($displayData['item']->catid, $displayData['item']->category_language)
				)
				. '" itemprop="genre">' . $title . '</a>'; ?>
			<?php echo $url; ?>
		<?php else : ?>
			<?php echo '<span itemprop="genre">' . $title . '</span>'; ?>
		<?php endif; ?>
	<?php endif; ?>
</dd>
