<?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
 */
defined('_JEXEC') or die;
$el = $this->el('div', [

	'class' =>  $this->expr([
		'djc_description',
		'uk-text-{description_text_style}' => ['description_text_style' => $element['description_text_style']],
		'uk-text-{description_text_size} {@!description_text_style}' => ['description_text_size' => $element['description_text_size'], 'description_text_style' => $element['description_text_style']],
		'uk-text-{description_text_color}'  => ['description_text_color' => $element['description_text_color']],
		'uk-dropcap {@description_dropcap}' => ['description_description_dropcap' => $element['description_dropcap']],
		'uk-column-{description_column}[@{description_column_breakpoint}]' => ['description_column' => $element['description_column'], 'description_column_breakpoint' => $element['description_column_breakpoint']],
		'uk-column-divider {@description_column} {@description_column_divider}' => ['description_column' => $element['description_column'], 'description_column_divider' => $element['description_column_divider']],
		'uk-margin[-{description_margin}]-top {@!description_margin: remove}',
		'uk-margin-remove-top {@description_margin: remove}',
		'uk-margin-remove-bottom',
		'uk-inline {@position_inline_description}' => ['position_inline_description' => $element['position_inline_description']],
	], $element),
	'grid' => true,


]);

// Column
$breakpoints = ['xl', 'l', 'm', 's', ''];

if ($element['description_column'] && false !== $index = array_search($element['description_column_breakpoint'], $breakpoints)) {

	list(, $columns) = explode('-', $element['description_column']);

	foreach (array_splice($breakpoints, $index + 1, 4) as $breakpoint) {

		if ($columns < 2) {
			break;
		}

		$el->attr('class', ['uk-column-1-' . (--$columns) . ($breakpoint ? "@{$breakpoint}" : '')]);
	}
}

//Style position && size of an element
$el->attr('style', [
	'position:{position_description};' => ['position_description' => $element['position_description']],
	'left: {position_left_description}px;' => ['position_left_description' => $element['position_left_description']],
	'right: {position_right_description}px;' => ['position_right_description' => $element['position_right_description']],
	'top: {position_top_description}px;' => ['position_top_description' => $element['position_top_description']],
	'bottom: {position_bottom_description}px;' => ['position_bottom_description' => $element['position_bottom_description']],
	'z-index:{position_z_index_description};' => ['position_z_index_description' => $element['position_z_index_description']],
	'width:{description_width};' => ['description_width' => $element['description_width']],
	'height:{description_height};' => ['description_height' => $element['description_height']],

], $element);

echo $el($props, $attrs, $props['description']);
