<?php
/**
 * @package DJ-Catalog2-Yootheme
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 */

namespace YOOtheme;
defined('_JEXEC') or die;
/**
 * @var ImageProvider $imageProvider
 */
$imageProvider = app(ImageProvider::class);

$linkCategory = $props['category_link'] ? $this->el('a', [
	'href' => $props['category_link'],
]) : null;

if ($linkCategory) {
	$linkCategory->attr([
		'target' => ['_blank {@category_image_link_target}'],
		'uk-scroll' => strpos($props['category_link'], '#') === 0,
	]);
}

if ($linkCategory && $props['category_image'] && $element['category_image_link'] && $props['category_link']) {

	$props['category_image'] = $linkCategory($element, ['class' => [

		'uk-display-block' => $element['panel_style'] && $element['has_panel_card_image'] ,

	]], $props['category_image']);

}

if ($linkCategory && $props['category_link']) {
	$linkCategory->attr([
		'class' => [
			'djc_category_link',
			'el-link',
			'uk-{category_image_link_style: link-(muted|text)}',
			'uk-button uk-button-{!category_image_link_style: |link-muted|link-text} [uk-button-{category_image_link_size}]',
		],
	]);
}

return $linkCategory;
