FOF30\Render\AkeebaStrapper::renderFieldsetLabel PHP Метод

renderFieldsetLabel() публичный Метод

Renders a label for a fieldset.
public renderFieldsetLabel ( object $field, Form &$form, string $title ) : string
$field object The field of the label to render
$form FOF30\Form\Form
$title string The title of the label
Результат string The rendered label
    public function renderFieldsetLabel($field, Form &$form, $title)
    {
        $html = '';
        $labelClass = $field->labelClass ? $field->labelClass : $field->labelclass;
        // Joomla! 2.5/3.x use different case for the same name
        $required = $field->required;
        $tooltip = $form->getFieldAttribute($field->fieldname, 'tooltip', '', $field->group);
        if (!empty($tooltip)) {
            static $loadedTooltipScript = false;
            if (!$loadedTooltipScript) {
                $js = <<<JS
(function(\$)
{
\t\$(document).ready(function()
\t{
\t\t\$('.fof-tooltip').tooltip({placement: 'top'});
\t});
})(akeeba.jQuery);
JS;
                $document = $this->container->platform->getDocument();
                if ($document instanceof \JDocument) {
                    $document->addScriptDeclaration($js);
                }
                $loadedTooltipScript = true;
            }
            $tooltipText = '<strong>' . \JText::_($title) . '</strong><br />' . \JText::_($tooltip);
            $html .= "\t\t\t\t" . '<label class="control-label fof-tooltip ' . $labelClass . '" for="' . $field->id . '" title="' . $tooltipText . '" data-toggle="fof-tooltip">';
        } else {
            $html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">';
        }
        $html .= \JText::_($title);
        if ($required) {
            $html .= ' *';
        }
        $html .= '</label>' . "\n";
        return $html;
    }