From 146b36f911e18915680be36af4e29e39333fc4fd Mon Sep 17 00:00:00 2001 From: Ruud van Lent Date: Tue, 11 Nov 2025 14:27:23 +0100 Subject: [PATCH 1/5] Expand useGlobal to also use plugin parameters --- libraries/src/Form/Field/TextField.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libraries/src/Form/Field/TextField.php b/libraries/src/Form/Field/TextField.php index 38a0ebb297bdd..f3c57bb2d88b2 100644 --- a/libraries/src/Form/Field/TextField.php +++ b/libraries/src/Form/Field/TextField.php @@ -14,7 +14,9 @@ use Joomla\CMS\Form\FormField; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; +use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Uri\Uri; +use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -228,6 +230,17 @@ protected function getInput() } $params = ComponentHelper::getParams($component); + + if ((string) $this->element['useglobal'] !== 'true' && \substr_count((string) $this->element['useglobal'], '_') === 2) { + // Get the correct plugin parameters + [$prefix, $type, $plugin] = \explode('_', (string) $this->element['useglobal'], 3); + + if ($prefix === 'plg' && PluginHelper::isEnabled($type, $plugin)) { + $plugin = PluginHelper::getPlugin($type, $plugin); + $params = new Registry($plugin->params); + } + } + $value = $params->get($this->fieldname); // Try with global configuration From fb66bf3344eeed287e2e93dd7a8011f4475acbe2 Mon Sep 17 00:00:00 2001 From: Ruud van Lent Date: Tue, 11 Nov 2025 14:55:54 +0100 Subject: [PATCH 2/5] satisfy php-cs-fixer --- libraries/src/Form/Field/TextField.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/src/Form/Field/TextField.php b/libraries/src/Form/Field/TextField.php index f3c57bb2d88b2..03b30ebb40521 100644 --- a/libraries/src/Form/Field/TextField.php +++ b/libraries/src/Form/Field/TextField.php @@ -231,9 +231,9 @@ protected function getInput() $params = ComponentHelper::getParams($component); - if ((string) $this->element['useglobal'] !== 'true' && \substr_count((string) $this->element['useglobal'], '_') === 2) { + if ((string) $this->element['useglobal'] !== 'true' && substr_count((string) $this->element['useglobal'], '_') === 2) { // Get the correct plugin parameters - [$prefix, $type, $plugin] = \explode('_', (string) $this->element['useglobal'], 3); + [$prefix, $type, $plugin] = explode('_', (string) $this->element['useglobal'], 3); if ($prefix === 'plg' && PluginHelper::isEnabled($type, $plugin)) { $plugin = PluginHelper::getPlugin($type, $plugin); From 70ecc62dc716be72ca4bd0ad444c1c526761769f Mon Sep 17 00:00:00 2001 From: Ruud van Lent Date: Wed, 19 Nov 2025 17:47:55 +0100 Subject: [PATCH 3/5] Expand useGlobal to also specify which component parameters to use --- joomla-cms | 1 + libraries/src/Form/Field/TextField.php | 29 ++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) create mode 120000 joomla-cms diff --git a/joomla-cms b/joomla-cms new file mode 120000 index 0000000000000..70c25a4a3eada --- /dev/null +++ b/joomla-cms @@ -0,0 +1 @@ +joomla-cms \ No newline at end of file diff --git a/libraries/src/Form/Field/TextField.php b/libraries/src/Form/Field/TextField.php index 03b30ebb40521..56cfb1be93965 100644 --- a/libraries/src/Form/Field/TextField.php +++ b/libraries/src/Form/Field/TextField.php @@ -220,18 +220,11 @@ public function setup(\SimpleXMLElement $element, $value, $group = null) protected function getInput() { if ($this->element['useglobal']) { - $component = Factory::getApplication()->getInput()->getCmd('option'); - // Get correct component for menu items - if ($component === 'com_menus') { - $link = $this->form->getData()->get('link'); - $uri = new Uri($link); - $component = $uri->getVar('option', 'com_menus'); - } - - $params = ComponentHelper::getParams($component); - - if ((string) $this->element['useglobal'] !== 'true' && substr_count((string) $this->element['useglobal'], '_') === 2) { + if (\str_starts_with((string) $this->element['useglobal'], 'com_')) { + // Get the correct component parameters + $params = ComponentHelper::getParams((string) $this->element['useglobal']); + } elseif (substr_count((string) $this->element['useglobal'], '_') === 2) { // Get the correct plugin parameters [$prefix, $type, $plugin] = explode('_', (string) $this->element['useglobal'], 3); @@ -241,6 +234,20 @@ protected function getInput() } } + if (!isset($params)) { + // Fallback for B/C + $component = Factory::getApplication()->getInput()->getCmd('option'); + + // Get correct component for menu items + if ($component === 'com_menus') { + $link = $this->form->getData()->get('link'); + $uri = new Uri($link); + $component = $uri->getVar('option', 'com_menus'); + } + + $params = ComponentHelper::getParams($component); + } + $value = $params->get($this->fieldname); // Try with global configuration From c8355452b98ea7888f81db37504cd0b45ce927ad Mon Sep 17 00:00:00 2001 From: Ruud van Lent Date: Thu, 20 Nov 2025 08:42:22 +0100 Subject: [PATCH 4/5] satisfy php-cs-fixer --- libraries/src/Form/Field/TextField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/src/Form/Field/TextField.php b/libraries/src/Form/Field/TextField.php index 56cfb1be93965..22e8dff7b8b62 100644 --- a/libraries/src/Form/Field/TextField.php +++ b/libraries/src/Form/Field/TextField.php @@ -221,7 +221,7 @@ protected function getInput() { if ($this->element['useglobal']) { - if (\str_starts_with((string) $this->element['useglobal'], 'com_')) { + if (str_starts_with((string) $this->element['useglobal'], 'com_')) { // Get the correct component parameters $params = ComponentHelper::getParams((string) $this->element['useglobal']); } elseif (substr_count((string) $this->element['useglobal'], '_') === 2) { From 63c4231bfd90253174a5de88deb1fa239e329bb2 Mon Sep 17 00:00:00 2001 From: Ruud van Lent Date: Thu, 20 Nov 2025 09:04:51 +0100 Subject: [PATCH 5/5] satisfy php-cs-fixer --- libraries/src/Form/Field/TextField.php | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/src/Form/Field/TextField.php b/libraries/src/Form/Field/TextField.php index 22e8dff7b8b62..b8b11a940056c 100644 --- a/libraries/src/Form/Field/TextField.php +++ b/libraries/src/Form/Field/TextField.php @@ -220,7 +220,6 @@ public function setup(\SimpleXMLElement $element, $value, $group = null) protected function getInput() { if ($this->element['useglobal']) { - if (str_starts_with((string) $this->element['useglobal'], 'com_')) { // Get the correct component parameters $params = ComponentHelper::getParams((string) $this->element['useglobal']);