diff --git a/administrator/language/en-GB/en-GB.com_fields.ini b/administrator/language/en-GB/en-GB.com_fields.ini index 66fed311f5c93..aef4636b11083 100644 --- a/administrator/language/en-GB/en-GB.com_fields.ini +++ b/administrator/language/en-GB/en-GB.com_fields.ini @@ -67,7 +67,7 @@ COM_FIELDS_N_ITEMS_UPDATED="%d fields successfully updated in calendar %s" COM_FIELDS_SYSTEM_PLUGIN_NOT_ENABLED="The Fields System Plugin is disabled. The custom fields will not display if you do not enable this plugin." COM_FIELDS_TYPE_CALENDAR="Calendar" COM_FIELDS_TYPE_CAPTCHA="CAPTCHA" -COM_FIELDS_TYPE_CHECKBOXES="Checkbox" +COM_FIELDS_TYPE_CHECKBOXES="Checkboxes" COM_FIELDS_TYPE_COLOR="Colour" COM_FIELDS_TYPE_EDITOR="Editor" COM_FIELDS_TYPE_EMAIL="Email" diff --git a/administrator/language/en-GB/en-GB.lib_joomla.ini b/administrator/language/en-GB/en-GB.lib_joomla.ini index f5cd0424d6eea..c279f8dfa9217 100644 --- a/administrator/language/en-GB/en-GB.lib_joomla.ini +++ b/administrator/language/en-GB/en-GB.lib_joomla.ini @@ -311,9 +311,9 @@ JLIB_FORM_FIELD_PARAM_CALENDAR_FORMAT_DESC="The date format to be used. This is JLIB_FORM_FIELD_PARAM_CALENDAR_FORMAT_LABEL="Format" JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_DESC="Allow multiple values to be selected." JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_LABEL="Multiple" -JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_DESC="The options of the list." -JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_KEY_LABEL="Key" -JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_LABEL="Checkbox Values" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_DESC="The options of the checkbox list" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_NAME_LABEL="Text" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_LABEL="Checkbox options" JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_VALUE_LABEL="Value" JLIB_FORM_FIELD_PARAM_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." JLIB_FORM_FIELD_PARAM_EDITOR_BUTTONS_HIDE_LABEL="Hide Buttons" @@ -334,9 +334,9 @@ JLIB_FORM_FIELD_PARAM_INTEGER_STEP_LABEL="Step" JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_DESC="Allow multiple values to be selected." JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_LABEL="Multiple" JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_DESC="The options of the list." -JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_LABEL="List Values" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_LABEL="List options" JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_VALUE_LABEL="Value" -JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_NAME_LABEL="Name" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_NAME_LABEL="Text" JLIB_FORM_FIELD_PARAM_MEDIA_IMAGE_CLASS_DESC="The class which is added to the image (src tag)." JLIB_FORM_FIELD_PARAM_MEDIA_IMAGE_CLASS_LABEL="Image Class" JLIB_FORM_FIELD_PARAM_MEDIA_PREVIEW_DESC="Shows or hides the preview of the selected image." @@ -347,9 +347,9 @@ JLIB_FORM_FIELD_PARAM_MEDIA_HOME_LABEL="Home Directory" JLIB_FORM_FIELD_PARAM_MEDIA_HOME_DESC="Should the directory with the files point to a user directory." JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_DESC="Allow multiple values to be selected." JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_LABEL="Multiple" -JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_DESC="The options of the list." -JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_KEY_LABEL="Key" -JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_LABEL="Radio Values" +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_DESC="The options of the radio list." +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_NAME_LABEL="Text" +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_LABEL="Radio options" JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_VALUE_LABEL="Value" JLIB_FORM_FIELD_PARAM_SQL_QUERY_DESC="The SQL query which will provide the data for the drop-down list. The query must return two columns; one called 'value' which will hold the values of the list items; the other called 'text' containing the text in the drop-down list." JLIB_FORM_FIELD_PARAM_SQL_QUERY_LABEL="Query" diff --git a/components/com_fields/layouts/field/prepare/checkboxes.php b/components/com_fields/layouts/field/prepare/checkboxes.php index 42cad0aa00ccc..7558dfac2461b 100644 --- a/components/com_fields/layouts/field/prepare/checkboxes.php +++ b/components/com_fields/layouts/field/prepare/checkboxes.php @@ -23,13 +23,13 @@ $value = (array) $value; $texts = array(); -$options = JFormFieldList::getOptionsFromField($field); +$options = JFormAbstractlist::getOptionsFromField($field); -foreach ($options as $index => $optionsValue) +foreach ($options as $optionValue => $optionText) { - if (in_array($index, $value)) + if (in_array($optionValue, $value)) { - $texts[] = $optionsValue; + $texts[] = JText::_($optionText); } } diff --git a/components/com_fields/layouts/field/prepare/list.php b/components/com_fields/layouts/field/prepare/list.php index 1971e36ebabb8..bf76d56e950a6 100644 --- a/components/com_fields/layouts/field/prepare/list.php +++ b/components/com_fields/layouts/field/prepare/list.php @@ -25,12 +25,13 @@ $texts = array(); $options = JFormAbstractlist::getOptionsFromField($field); -foreach ($options as $index => $optionsValue) +foreach ($options as $optionValue => $optionText) { - if (in_array($index, $value)) + if (in_array($optionValue, $value)) { - $texts[] = $optionsValue; + $texts[] = JText::_($optionText); } } + echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/radio.php b/components/com_fields/layouts/field/prepare/radio.php new file mode 100644 index 0000000000000..bf76d56e950a6 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/radio.php @@ -0,0 +1,37 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$texts = array(); +$options = JFormAbstractlist::getOptionsFromField($field); + +foreach ($options as $optionValue => $optionText) +{ + if (in_array($optionValue, $value)) + { + $texts[] = JText::_($optionText); + } +} + + +echo htmlentities(implode(', ', $texts)); diff --git a/language/en-GB/en-GB.lib_joomla.ini b/language/en-GB/en-GB.lib_joomla.ini index f5cd0424d6eea..9a79a6e3d1e47 100644 --- a/language/en-GB/en-GB.lib_joomla.ini +++ b/language/en-GB/en-GB.lib_joomla.ini @@ -312,7 +312,7 @@ JLIB_FORM_FIELD_PARAM_CALENDAR_FORMAT_LABEL="Format" JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_DESC="Allow multiple values to be selected." JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_LABEL="Multiple" JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_DESC="The options of the list." -JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_KEY_LABEL="Key" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_NAME_LABEL="Text" JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_LABEL="Checkbox Values" JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_VALUE_LABEL="Value" JLIB_FORM_FIELD_PARAM_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." @@ -336,7 +336,7 @@ JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_LABEL="Multiple" JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_DESC="The options of the list." JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_LABEL="List Values" JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_VALUE_LABEL="Value" -JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_NAME_LABEL="Name" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_NAME_LABEL="Text" JLIB_FORM_FIELD_PARAM_MEDIA_IMAGE_CLASS_DESC="The class which is added to the image (src tag)." JLIB_FORM_FIELD_PARAM_MEDIA_IMAGE_CLASS_LABEL="Image Class" JLIB_FORM_FIELD_PARAM_MEDIA_PREVIEW_DESC="Shows or hides the preview of the selected image." @@ -348,7 +348,7 @@ JLIB_FORM_FIELD_PARAM_MEDIA_HOME_DESC="Should the directory with the files point JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_DESC="Allow multiple values to be selected." JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_LABEL="Multiple" JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_DESC="The options of the list." -JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_KEY_LABEL="Key" +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_NAME_LABEL="Text" JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_LABEL="Radio Values" JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_VALUE_LABEL="Value" JLIB_FORM_FIELD_PARAM_SQL_QUERY_DESC="The SQL query which will provide the data for the drop-down list. The query must return two columns; one called 'value' which will hold the values of the list items; the other called 'text' containing the text in the drop-down list." diff --git a/libraries/joomla/form/abstractlist.php b/libraries/joomla/form/abstractlist.php index 237f8ee15f8d8..073de8366d3f1 100644 --- a/libraries/joomla/form/abstractlist.php +++ b/libraries/joomla/form/abstractlist.php @@ -228,9 +228,9 @@ public static function getOptionsFromField($field) if (isset($options->name)) { - foreach ($options->name as $index => $key) + foreach ($options->value as $index => $key) { - $data[$key] = $options->value[$index]; + $data[$key] = $options->name[$index]; } } diff --git a/libraries/joomla/form/parameters/checkboxes.xml b/libraries/joomla/form/parameters/checkboxes.xml index 03f0fbe574599..641dee4e8eff3 100644 --- a/libraries/joomla/form/parameters/checkboxes.xml +++ b/libraries/joomla/form/parameters/checkboxes.xml @@ -12,7 +12,7 @@