/**
* Method to get the field label markup.
*
* @return string The field label markup.
*
* @since 1.7.0
*/
protected function getLabel()
{
if (empty($this->element['label']) && empty($this->element['description'])) {
return '';
}
$html = [];
$class = [];
if (!empty($this->class)) {
$class[] = $this->class;
}
if ($close = (string) $this->element['close']) {
HTMLHelper::_('bootstrap.alert');
$close = $close === 'true' ? 'alert' : $close;
$html[] = '<button type="button" class="btn-close" data-bs-dismiss="' . $close . '"></button>';
$class[] = 'alert-dismissible show';
}
$class = $class ? ' class="' . implode(' ', $class) . '"' : '';
$title = $this->element['label'] ? (string) $this->element['label'] : ($this->element['title'] ? (string) $this->element['title'] : '');
$heading = $this->element['heading'] ? (string) $this->element['heading'] : 'h4';
$description = (string) $this->element['description'];
$html[] = !empty($title) ? '<' . $heading . '>' . Text::_($title) . '</' . $heading . '>' : '';
$html[] = !empty($description) ? Text::_($description) : '';
return '</div><div ' . $class . '>' . implode('', $html);
}