From 0296b17337c24c2b0237b81bd1b836d56e812486 Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Wed, 3 Apr 2024 16:11:14 +0700 Subject: [PATCH 01/25] Update astroidlist and astroidtext compatible J5 --- framework/fields/astroidlist.php | 20 +- framework/fields/astroidtext.php | 8 +- framework/fields/checkbox.php | 151 ----------- framework/fields/checkboxes.php | 167 ------------ framework/fields/file.php | 142 ----------- framework/fields/hidden.php | 64 ----- framework/fields/language.php | 94 ------- framework/fields/radio.php | 74 ------ framework/fields/sql.php | 322 ------------------------ framework/layouts/fields/checkboxes.php | 88 ------- framework/layouts/fields/file.php | 64 ----- framework/layouts/fields/hidden.php | 53 ---- framework/layouts/fields/radio.php | 86 ------- 13 files changed, 18 insertions(+), 1315 deletions(-) delete mode 100644 framework/fields/checkbox.php delete mode 100644 framework/fields/checkboxes.php delete mode 100644 framework/fields/file.php delete mode 100644 framework/fields/hidden.php delete mode 100644 framework/fields/language.php delete mode 100644 framework/fields/radio.php delete mode 100644 framework/fields/sql.php delete mode 100644 framework/layouts/fields/checkboxes.php delete mode 100644 framework/layouts/fields/file.php delete mode 100644 framework/layouts/fields/hidden.php delete mode 100644 framework/layouts/fields/radio.php diff --git a/framework/fields/astroidlist.php b/framework/fields/astroidlist.php index 0da469b3..7b5c6e42 100644 --- a/framework/fields/astroidlist.php +++ b/framework/fields/astroidlist.php @@ -10,6 +10,12 @@ use Joomla\CMS\Form\FormField; use Joomla\CMS\Language\Text; use Joomla\CMS\Factory; +use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Language\Associations; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Helper\ModuleHelper; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Component\ComponentHelper; /** * Form Field class for the Joomla Platform. * Supports a generic list of options. @@ -114,22 +120,22 @@ protected function getOptions() { // Filter requirements if ($requires = explode(',', (string) $option['requires'])) { // Requires multilanguage - if (in_array('multilanguage', $requires) && !JLanguageMultilang::isEnabled()) { + if (in_array('multilanguage', $requires) && !Multilanguage::isEnabled()) { continue; } // Requires associations - if (in_array('associations', $requires) && !JLanguageAssociations::isEnabled()) { + if (in_array('associations', $requires) && !Associations::isEnabled()) { continue; } // Requires adminlanguage - if (in_array('adminlanguage', $requires) && !JModuleHelper::isAdminMultilang()) { + if (in_array('adminlanguage', $requires) && !ModuleHelper::isAdminMultilang()) { continue; } // Requires vote plugin - if (in_array('vote', $requires) && !JPluginHelper::isEnabled('content', 'vote')) { + if (in_array('vote', $requires) && !PluginHelper::isEnabled('content', 'vote')) { continue; } } @@ -176,11 +182,11 @@ protected function getOptions() { // Get correct component for menu items if ($component == 'com_menus') { $link = $this->form->getData()->get('link'); - $uri = new JUri($link); + $uri = new Uri($link); $component = $uri->getVar('option', 'com_menus'); } - $params = JComponentHelper::getParams($component); + $params = ComponentHelper::getParams($component); $value = $params->get($this->fieldname); // Try with global configuration @@ -190,7 +196,7 @@ protected function getOptions() { // Try with menu configuration if (is_null($value) && Factory::getApplication()->input->getCmd('option') == 'com_menus') { - $value = JComponentHelper::getParams('com_menus')->get($this->fieldname); + $value = ComponentHelper::getParams('com_menus')->get($this->fieldname); } if (!is_null($value)) { diff --git a/framework/fields/astroidtext.php b/framework/fields/astroidtext.php index 9e13e823..536fda8f 100644 --- a/framework/fields/astroidtext.php +++ b/framework/fields/astroidtext.php @@ -7,6 +7,8 @@ */ defined('JPATH_PLATFORM') or die; use Joomla\CMS\Form\FormField; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; /** * Form Field class for the Joomla Platform. * Supports a one line text field. @@ -133,7 +135,7 @@ public function setup(SimpleXMLElement $element, $value, $group = null) { $inputmode = explode(' ', $inputmode); if (!empty($inputmode)) { - $defaultInputmode = in_array('default', $inputmode) ? JText::_('JLIB_FORM_INPUTMODE') . ' ' : ''; + $defaultInputmode = in_array('default', $inputmode) ? Text::_('JLIB_FORM_INPUTMODE') . ' ' : ''; foreach (array_keys($inputmode, 'default') as $key) { unset($inputmode[$key]); @@ -188,8 +190,8 @@ protected function getOptions() { } // Create a new option object based on the