diff --git a/libraries/joomla/form/fields/spacer.php b/libraries/joomla/form/fields/spacer.php index 5b9f1820ca098..b90c8def980f7 100644 --- a/libraries/joomla/form/fields/spacer.php +++ b/libraries/joomla/form/fields/spacer.php @@ -68,7 +68,7 @@ protected function getLabel() $text = $this->translateLabel ? JText::_($text) : $text; // Build the class for the label. - $class = !empty($this->description) ? 'hasTooltip' : ''; + $class = !empty($this->description) ? 'hasPopover' : ''; $class = $this->required == true ? $class . ' required' : $class; // Add the opening label tag and main attributes attributes. @@ -77,8 +77,18 @@ protected function getLabel() // If a description is specified, use it to build a tooltip. if (!empty($this->description)) { - JHtml::_('bootstrap.tooltip'); - $label .= ' title="' . JHtml::_('tooltipText', trim($text, ':'), JText::_($this->description), 0) . '"'; + JHtml::_('bootstrap.popover'); + $label .= ' title="' . htmlspecialchars(trim($text, ':'), ENT_COMPAT, 'UTF-8') . '"'; + $label .= ' data-content="' . htmlspecialchars( + $this->translateDescription ? JText::_($this->description) : $this->description, + ENT_COMPAT, + 'UTF-8' + ) . '"'; + + if (JFactory::getLanguage()->isRtl()) + { + $label .= ' data-placement="left"'; + } } // Add the label text and closing tag. diff --git a/tests/unit/suites/libraries/joomla/form/fields/JFormFieldSpacerTest.php b/tests/unit/suites/libraries/joomla/form/fields/JFormFieldSpacerTest.php index 8c6ec281c776a..de656a4a02741 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/JFormFieldSpacerTest.php +++ b/tests/unit/suites/libraries/joomla/form/fields/JFormFieldSpacerTest.php @@ -119,7 +119,7 @@ public function testGetLabel() ); $equals = '' . - '' . + '' . ''; $this->assertEquals(