. */ use Joomla\CMS\Form\FormHelper; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; defined('_JEXEC') or die(); FormHelper::loadFieldClass('Spacer'); class JFormFieldSubtitle extends JFormFieldSpacer { /** * @inheritDoc */ protected function getLabel() { $html = []; $class = $this->class ?: sprintf(' class="%s"', $this->class); $tag = $this->element['tag'] ? (string)$this->element['tag'] : 'h4'; $html[] = ''; $html[] = ''; $html[] = ''; if ((string)$this->element['hr'] == 'true') { $html[] = ''; } else { $label = ''; // Get the label text from the XML element, defaulting to the element name. $text = (string)$this->element['label'] ?: (string)$this->element['name']; $text = $this->translateLabel ? Text::_($text) : $text; // Build the class for the label. $class = $this->description ? 'hasTooltip' : ''; $class = $this->required == true ? $class . ' required' : $class; // Add the opening label tag and main attributes attributes. $label .= '<' . $tag . ' id="' . $this->id . '-lbl" class="' . $class . '"'; if ($this->description) { // Use description to build a tooltip. HTMLHelper::_('bootstrap.tooltip'); $label .= sprintf( ' title="%s"', HTMLHelper::tooltipText(trim($text, ':'), Text::_($this->description), 0) ); } // Add the label text and closing tag. $label .= '>' . $text . ''; $html[] = $label; } $html[] = ''; $html[] = ''; $html[] = ''; return implode('', $html); } }