diff --git a/administrator/components/com_contact/config.xml b/administrator/components/com_contact/config.xml index 3bc8da197b319..372ac136cf585 100644 --- a/administrator/components/com_contact/config.xml +++ b/administrator/components/com_contact/config.xml @@ -909,11 +909,10 @@ type="plugins" label="COM_CONTACT_FIELD_CAPTCHA_LABEL" description="COM_CONTACT_FIELD_CAPTCHA_DESC" - default="" folder="captcha" filter="cmd" + useglobal="true" > - diff --git a/administrator/components/com_content/config.xml b/administrator/components/com_content/config.xml index 01b5110bf3dda..dc42fc66b1ef2 100644 --- a/administrator/components/com_content/config.xml +++ b/administrator/components/com_content/config.xml @@ -385,11 +385,10 @@ type="plugins" label="COM_CONTENT_FIELD_CAPTCHA_LABEL" description="COM_CONTENT_FIELD_CAPTCHA_DESC" - default="" folder="captcha" filter="cmd" + useglobal="true" > - diff --git a/administrator/components/com_users/config.xml b/administrator/components/com_users/config.xml index 3a4c88a34c468..a177ececa07b0 100644 --- a/administrator/components/com_users/config.xml +++ b/administrator/components/com_users/config.xml @@ -75,10 +75,9 @@ label="COM_USERS_CONFIG_FIELD_CAPTCHA_LABEL" description="COM_USERS_CONFIG_FIELD_CAPTCHA_DESC" folder="captcha" - default="" - filter="cmd" + filter="cmd" + useglobal="true" > - diff --git a/administrator/language/en-GB/en-GB.com_contact.ini b/administrator/language/en-GB/en-GB.com_contact.ini index b48bdfcca6523..09e31530add4f 100644 --- a/administrator/language/en-GB/en-GB.com_contact.ini +++ b/administrator/language/en-GB/en-GB.com_contact.ini @@ -32,7 +32,7 @@ COM_CONTACT_FIELD_ARTICLES_SHOW_DESC="If this contact is mapped to a user, and i COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL="Show User Articles" COM_CONTACT_FIELD_BREADCRUMBS_DESC="Show or hide category breadcrumbs." COM_CONTACT_FIELD_BREADCRUMBS_LABEL="Show Category Breadcrumbs" -COM_CONTACT_FIELD_CAPTCHA_DESC="Select the captcha plugin that will be used in the contact form. You may need to enter required information for your captcha plugin in the Plugin Manager.
If 'Use Default' is selected, make sure a captcha plugin is selected in Global Configuration." +COM_CONTACT_FIELD_CAPTCHA_DESC="Select the captcha plugin that will be used in the contact form. You may need to enter required information for your captcha plugin in the Plugin Manager.
If 'Use Global' is selected, make sure a captcha plugin is selected in Global Configuration." COM_CONTACT_FIELD_CAPTCHA_LABEL="Allow Captcha on Contact" COM_CONTACT_FIELD_CATEGORIES_DESC="Displays a list of contact categories within a category." COM_CONTACT_FIELD_CATEGORIES_LABEL="Choose a Parent Category" diff --git a/administrator/language/en-GB/en-GB.com_content.ini b/administrator/language/en-GB/en-GB.com_content.ini index a70b8bf957976..a8722b5f73f06 100644 --- a/administrator/language/en-GB/en-GB.com_content.ini +++ b/administrator/language/en-GB/en-GB.com_content.ini @@ -49,7 +49,7 @@ COM_CONTENT_FIELD_BROWSER_PAGE_TITLE_DESC="Optional text for the "Browser p COM_CONTENT_FIELD_BROWSER_PAGE_TITLE_LABEL="Browser Page Title" COM_CONTENT_FIELD_ARTICLETEXT_DESC="Enter the article content in the text area." COM_CONTENT_FIELD_ARTICLETEXT_LABEL="Article Text" -COM_CONTENT_FIELD_CAPTCHA_DESC="Select the captcha plugin that will be used in the article submit form. You may need to enter required information for your captcha plugin in the Plugin Manager.
If 'Use Default' is selected, make sure a captcha plugin is selected in Global Configuration." +COM_CONTENT_FIELD_CAPTCHA_DESC="Select the captcha plugin that will be used in the article submit form. You may need to enter required information for your captcha plugin in the Plugin Manager.
If 'Use Global' is selected, make sure a captcha plugin is selected in Global Configuration." COM_CONTENT_FIELD_CAPTCHA_LABEL="Allow Captcha on submit" COM_CONTENT_FIELD_CREATED_BY_ALIAS_DESC="Enter an alias to be displayed instead of the name of the user who created the article." COM_CONTENT_FIELD_CREATED_BY_ALIAS_LABEL="Created by Alias" diff --git a/administrator/language/en-GB/en-GB.com_users.ini b/administrator/language/en-GB/en-GB.com_users.ini index 61d90510be749..8b34dc17e11a4 100644 --- a/administrator/language/en-GB/en-GB.com_users.ini +++ b/administrator/language/en-GB/en-GB.com_users.ini @@ -17,7 +17,7 @@ COM_USERS_CATEGORIES_TITLE="User Notes: Categories" COM_USERS_CATEGORY_HEADING="Category" COM_USERS_CONFIG_FIELD_ALLOWREGISTRATION_DESC="If set to Yes, new Users are allowed to self-register." COM_USERS_CONFIG_FIELD_ALLOWREGISTRATION_LABEL="Allow User Registration" -COM_USERS_CONFIG_FIELD_CAPTCHA_DESC="Select the captcha plugin that will be used in the registration, password and username reminder forms. You may need to enter required information for your captcha plugin in the Plugin Manager.
If 'Use Default' is selected, make sure a captcha plugin is selected in Global Configuration." +COM_USERS_CONFIG_FIELD_CAPTCHA_DESC="Select the captcha plugin that will be used in the registration, password and username reminder forms. You may need to enter required information for your captcha plugin in the Plugin Manager.
If 'Use Global' is selected, make sure a captcha plugin is selected in Global Configuration." COM_USERS_CONFIG_FIELD_CAPTCHA_LABEL="Captcha" COM_USERS_CONFIG_FIELD_CHANGEUSERNAME_DESC="Allow users to change their Username when editing their profile." COM_USERS_CONFIG_FIELD_CHANGEUSERNAME_LABEL="Change Username" diff --git a/libraries/joomla/form/fields/plugins.php b/libraries/joomla/form/fields/plugins.php index f4f490ccd9488..d374ef5cd37a4 100644 --- a/libraries/joomla/form/fields/plugins.php +++ b/libraries/joomla/form/fields/plugins.php @@ -112,7 +112,8 @@ public function setup(SimpleXMLElement $element, $value, $group = null) */ protected function getOptions() { - $folder = $this->folder; + $folder = $this->folder; + $parentOptions = parent::getOptions(); if (!empty($folder)) { @@ -124,19 +125,29 @@ protected function getOptions() ->where('folder = ' . $db->quote($folder)) ->where('enabled = 1') ->order('ordering, name'); - $db->setQuery($query); - $options = $db->loadObjectList(); + $options = $db->setQuery($query)->loadObjectList(); + $lang = JFactory::getLanguage(); + $useGlobal = $this->element['useglobal']; - $lang = JFactory::getLanguage(); + if ($useGlobal) + { + $globalValue = JFactory::getConfig()->get($this->fieldname); + } foreach ($options as $i => $item) { - $source = JPATH_PLUGINS . '/' . $folder . '/' . $item->value; + $source = JPATH_PLUGINS . '/' . $folder . '/' . $item->value; $extension = 'plg_' . $folder . '_' . $item->value; - $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, true) - || $lang->load($extension . '.sys', $source, null, false, true); + $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, true) || $lang->load($extension . '.sys', $source, null, false, true); $options[$i]->text = JText::_($item->text); + + // If we are using useglobal update the use global value text with the plugin text. + if ($useGlobal && isset($parentOptions[0]) && $item->value === $globalValue) + { + $text = JText::_($extension); + $parentOptions[0]->text = JText::sprintf('JGLOBAL_USE_GLOBAL_VALUE', ($text === '' || $text === $extension ? $item->value : $text)); + } } } else @@ -144,9 +155,6 @@ protected function getOptions() JLog::add(JText::_('JFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY'), JLog::WARNING, 'jerror'); } - // Merge any additional options in the XML definition. - $options = array_merge(parent::getOptions(), $options); - - return $options; + return array_merge($parentOptions, $options); } }