diff --git a/administrator/components/com_menus/models/fields/modal/menu.php b/administrator/components/com_menus/models/fields/modal/menu.php index 91bbbd5fa3330..bd0da938795cc 100644 --- a/administrator/components/com_menus/models/fields/modal/menu.php +++ b/administrator/components/com_menus/models/fields/modal/menu.php @@ -24,7 +24,7 @@ class JFormFieldModal_Menu extends JFormField * @since 3.7.0 */ protected $type = 'Modal_Menu'; - + /** * Determinate, if the select button is shown * @@ -32,7 +32,7 @@ class JFormFieldModal_Menu extends JFormField * @since 3.7.0 */ protected $allowSelect = true; - + /** * Determinate, if the clear button is shown * @@ -40,7 +40,7 @@ class JFormFieldModal_Menu extends JFormField * @since 3.7.0 */ protected $allowClear = true; - + /** * Determinate, if the create button is shown * @@ -48,7 +48,7 @@ class JFormFieldModal_Menu extends JFormField * @since 3.7.0 */ protected $allowNew = false; - + /** * Determinate, if the edit button is shown * @@ -218,7 +218,20 @@ function jSelectMenu_" . $this->id . "(id, title, object) { } } - $title = empty($title) ? JText::_('COM_MENUS_SELECT_A_MENUITEM') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); + // Placeholder if option is present or not + if (empty($title)) + { + if ($this->element->option && (string) $this->element->option['value'] == '') + { + $title_holder = JText::_($this->element->option, true); + } + else + { + $title_holder = JText::_('COM_MENUS_SELECT_A_MENUITEM', true); + } + } + + $title = empty($title) ? $title_holder : htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); // The current menu item display field. $html = ''; @@ -359,8 +372,18 @@ function jSelectMenu_" . $this->id . "(id, title, object) { // Note: class='required' for client side validation. $class = $this->required ? ' class="required modal-value"' : ''; + // Placeholder if option is present or not when clearing field + if ($this->element->option && (string) $this->element->option['value'] == '') + { + $title_holder = JText::_($this->element->option, true); + } + else + { + $title_holder = JText::_('COM_MENUS_SELECT_A_MENUITEM', true); + } + $html .= ''; + . '" data-text="' . htmlspecialchars($title_holder, ENT_COMPAT, 'UTF-8') . '" value="' . $value . '" />'; return $html; }