| Server IP : 172.67.191.97 / Your IP : 104.23.197.209 Web Server : Apache/2.4.63 (Ubuntu) System : Linux adminpruebas-Virtual-Machine 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.4.5 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/fcs/modules/mod_latestnewsenhanced/src/Field/ |
Upload File : |
<?php
/**
* @copyright Copyright (C) 2011 Simplify Your Web, Inc. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE.txt
*/
namespace SYW\Module\LatestNewsEnhanced\Site\Field;
defined( '_JEXEC' ) or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Form\Field\GroupedlistField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
class DateselectField extends GroupedlistField
{
public $type = 'Dateselect';
static $core_fields = null;
static function getCoreFields($allowed_types = array())
{
if (!isset(self::$core_fields)) {
$fields = FieldsHelper::getFields('com_content.article');
self::$core_fields = array();
if (!empty($fields)) {
foreach ($fields as $field) {
if (!empty($allowed_types) && !in_array($field->type, $allowed_types)) {
continue;
}
self::$core_fields[] = $field;
}
}
}
return self::$core_fields;
}
protected function getGroups()
{
$groups = array();
// get Joomla! fields
// test the fields folder first to avoid message warning that the component is missing
if (Folder::exists(JPATH_ADMINISTRATOR . '/components/com_fields') && ComponentHelper::isEnabled('com_fields') && ComponentHelper::getParams('com_content')->get('custom_fields_enable', '1')) {
// get the custom fields
$fields = self::getCoreFields(array('calendar'));
// organize the fields according to their group
$fieldsPerGroup = array(
0 => array()
);
$groupTitles = array(
0 => Text::_('MOD_LATESTNEWSENHANCEDEXTENDED_VALUE_NOGROUPFIELD')
);
$fields_exist = false;
foreach ($fields as $field) {
if (!array_key_exists($field->group_id, $fieldsPerGroup)) {
$fieldsPerGroup[$field->group_id] = array();
$groupTitles[$field->group_id] = $field->group_title;
}
$fieldsPerGroup[$field->group_id][] = $field;
$fields_exist = true;
}
// loop trough the groups
if ($fields_exist) {
$group_name = Text::_('MOD_LATESTNEWSENHANCEDEXTENDED_VALUE_JOOMLAFIELDS');
$groups[$group_name] = array();
foreach ($fieldsPerGroup as $group_id => $groupFields) {
if (!$groupFields) {
continue;
}
foreach ($groupFields as $field) {
$groups[$group_name][] = HTMLHelper::_('select.option', 'jfield:'.$field->type.':'.$field->id, $groupTitles[$group_id].': '.$field->title . ' (Pro)', 'value', 'text', $disable = true);
}
}
}
}
// Merge any additional options in the XML definition.
$groups = array_merge(parent::getGroups(), $groups);
return $groups;
}
}
?>