szurubooru/src/Views/sidebar-options.phtml

45 lines
1.1 KiB
PHTML
Raw Normal View History

<?php if (!empty($this->context->options)): ?>
<div class="unit options">
<h1>options</h1>
<ul>
<?php foreach ($this->context->options as $option): ?>
2014-04-27 14:44:06 +02:00
<li class="<?= $option['class']; if (isset($option['inactive'])) echo ' inactive' ?>">
<?php
$class = [];
$attrs = [];
if (!empty($option['link']))
{
$attrs['href'] = $option['link'];
}
elseif (!empty($option['simple-action']))
{
$attrs['href'] = $option['simple-action'];
$class []= 'simple-action';
if (isset($option['data-confirm-text']))
{
$attrs['data-confirm-text'] = $option['data-confirm-text'];
$class []= 'confirmable';
}
if (isset($option['data-redirect-url']))
$attrs['data-redirect-url'] = $option['data-redirect-url'];
}
else
$attrs['href'] = '#';
if (!empty($class))
$attrs['class'] = join(' ', $class);
echo TextHelper::htmlTag('a', TextHelper::HTML_OPEN, $attrs);
echo $option['text'];
echo TextHelper::htmlTag('a', TextHelper::HTML_CLOSE);
?>
</li>
<?php endforeach ?>
</ul>
</div>
<?php endif ?>