<?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', []);

if ($props['toggle_animation_use_advanced']) {
	$props['toggle_animation'] = $props['toggle_animation_advanced'];
} elseif ($props['toggle_animation'] == 'false') {
	$props['toggle_animation'] = $props['toggle_animation'];
} else {
	$props['toggle_animation'] = 'uk-animation-' . $props['toggle_animation'];
}
$hidden = $props['hidden'] ? 'hidden' : '';
if ($props['content']) {
	$toggleID = uniqid('djex-toggle-');
} else {
	$toggleID = '';
}


$button = $this->el('a', [

	'class' => [
		'uk-{button_style: link-(muted|text)}',
		'uk-button uk-button-{!button_style: |link-muted|link-text} [uk-button-{button_size}] [uk-width-1-1 {@button_fullwidth}]',
	],

	'uk-toggle' => [
        'target: #'.$toggleID.';',
		'mode: {toggle_mode};',
		'cls: false;',
		'animation: {toggle_animation};',
		'duration: {duration};',
	],

]);

?>

<?= $el($props, $attrs) ?>
	<div class="uk-margin">

		<?= $button($props) ?>

			<?php if ($props['icon_align'] == 'left' && $props['icon']) : ?>
				<span uk-icon="<?= $props['icon'] ?>"></span>
			<?php endif ?>

			<span class="uk-text-middle"><?= $props['button_text'] ?></span>

			<?php if ($props['icon_align'] == 'right' && $props['icon']) : ?>
				<span uk-icon="<?= $props['icon'] ?>"></span>
			<?php endif ?>

		<?= $button->end() ?>

	</div>

	<?php if ($props['content']) : ?>
		<div <?= ($toggleID != '') ? 'id="' . $toggleID . '"' : '' ?> class="uk-margin" <?= $hidden; ?>><?= $props['content'] ?></div>
	<?php endif ?>

</div>
