joomla-component/site/layouts/select.php
Robot 136fcd0fc2
Stable release of v5.0.1
First stable back-end and front-end release towards Joomla 4 and 5.
2024-01-29 09:31:35 +02:00

61 lines
2.7 KiB
PHP

<?php
/*----------------------------------------------------------------------------------| io.vdm.dev |----/
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@package getBible.net
@created 3rd December, 2015
@author Llewellyn van der Merwe <https://getbible.net>
@git Get Bible <https://git.vdm.dev/getBible>
@github Get Bible <https://github.com/getBible>
@support Get Bible <https://git.vdm.dev/getBible/support>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
/------------------------------------------------------------------------------------------------------*/
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\LayoutHelper;
use TrueChristianChurch\Component\Getbible\Site\Helper\GetbibleHelper;
// No direct access to this file
defined('JPATH_BASE') or die;
$id = (isset($displayData['id'])) ? $displayData['id'] : '';
$name = (isset($displayData['name'])) ? $displayData['name'] : $id;
$class = (isset($displayData['class'])) ? $displayData['class'] : 'uk-select';
$class_other = (isset($displayData['class_other'])) ? ' ' . $displayData['class_other'] : '';
$name = str_replace('-', '_', $name);
$options = (isset($displayData['options']) && is_array($displayData['options'])) ? $displayData['options'] : false;
$default = $displayData['default'] ?? '';
$onchange = (isset($displayData['onchange'])) ? ' onchange="' . $displayData['onchange'] . '"' : '';
$onkeydown = (isset($displayData['onkeydown'])) ? ' onkeydown="' . $displayData['onkeydown'] . '"' : '';
?>
<select class="<?php echo $class . $class_other; ?>" id="<?php echo $id; ?>" name="<?php echo $name; ?>"<?php echo $onkeydown; echo $onchange; ?>>
<?php if ($options): ?>
<?php foreach ($options as $key => $value): ?>
<?php if (is_object($value) && isset($value->key) && isset($value->value)): ?>
<?php if ($default === $value->key): ?>
<option value="<?php echo $value->key; ?>" selected><?php echo $value->value; ?></option>
<?php else: ?>
<option value="<?php echo $value->key; ?>"><?php echo $value->value; ?></option>
<?php endif; ?>
<?php else: ?>
<?php if ($default === $key): ?>
<option value="<?php echo $key; ?>" selected><?php echo $value; ?></option>
<?php else: ?>
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php else: ?>
<option><?php echo Text::_('COM_GETBIBLE_EMPTY'); ?></option>
<?php endif; ?>
</select>