| Current Path : /var/www/html/administrator/components/com_jchat/Field/ |
| Current File : /var/www/html/administrator/components/com_jchat/Field/LoadtemplatesField.php |
<?php
namespace JExtstore\Component\JChat\Administrator\Field;
/**
* @package JCHAT::CONFIG::administrator::components::com_jchat
* @subpackage Field
* @author Joomla! Extensions Store
* @copyright (C) 2024 - Joomla! Extensions Store
* @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html
*/
defined ( '_JEXEC' ) or die ( 'Restricted access' );
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\HTML\HTMLHelper;
/**
* Templates selector
* @package JCHAT::CONFIG::administrator::components::com_jchat
* @subpackage Field
* @since 1.0
*/
class LoadtemplatesField extends ListField {
/**
* The form field type.
*
* @var string
* @since 11.1
*/
protected $type = 'loadtemplates';
function getOptions() {
$options = array ();
$path = JPATH_SITE . '/components/com_jchat/css/templates';
$iterator = new \DirectoryIterator ( $path );
foreach ( $iterator as $fileEntity ) {
$fileName = $fileEntity->getFilename ();
if (! $fileEntity->isDot () && ! $fileEntity->isDir () && $fileName !== 'index.html' && strpos($fileName, 'default') !== 0) {
$name = ucfirst ( $fileEntity->getBasename ( '.css' ) );
$options [] = HTMLHelper::_ ( 'select.option', $fileEntity->getFilename (), $name );
}
}
$options = array_merge ( $options, parent::getOptions () );
sort($options);
array_unshift($options, HTMLHelper::_ ( 'select.option', 'default.css', ' -Default - ' ));
return $options;
}
}