|
11 | 11 | \defined('JPATH_PLATFORM') or die; |
12 | 12 |
|
13 | 13 | use Joomla\CMS\Form\FormField; |
| 14 | +use Joomla\CMS\HTML\HTMLHelper; |
14 | 15 | use Joomla\CMS\Language\Text; |
15 | 16 |
|
16 | 17 | /** |
@@ -60,22 +61,28 @@ protected function getLabel() |
60 | 61 | return ''; |
61 | 62 | } |
62 | 63 |
|
63 | | - $title = $this->element['label'] ? (string) $this->element['label'] : ($this->element['title'] ? (string) $this->element['title'] : ''); |
64 | | - $heading = $this->element['heading'] ? (string) $this->element['heading'] : 'h4'; |
65 | | - $description = (string) $this->element['description']; |
66 | | - $class = !empty($this->class) ? ' class="' . $this->class . '"' : ''; |
67 | | - $close = (string) $this->element['close']; |
| 64 | + $html = []; |
| 65 | + $class = []; |
68 | 66 |
|
69 | | - $html = array(); |
| 67 | + if (!empty($this->class)) |
| 68 | + { |
| 69 | + $class[] = $this->class; |
| 70 | + } |
70 | 71 |
|
71 | | - if ($close) |
| 72 | + if ($close = (string) $this->element['close']) |
72 | 73 | { |
73 | | - $close = $close === 'true' ? 'alert' : $close; |
74 | | - $html[] = '<button type="button" class="btn-close" data-dismiss="' . $close . '">×</button>'; |
| 74 | + HTMLHelper::_('bootstrap.alert'); |
| 75 | + $close = $close === 'true' ? 'alert' : $close; |
| 76 | + $html[] = '<button type="button" class="btn-close" data-bs-dismiss="' . $close . '"></button>'; |
| 77 | + $class[] = 'alert-dismissible show'; |
75 | 78 | } |
76 | 79 |
|
77 | | - $html[] = !empty($title) ? '<' . $heading . '>' . Text::_($title) . '</' . $heading . '>' : ''; |
78 | | - $html[] = !empty($description) ? Text::_($description) : ''; |
| 80 | + $class = $class ? ' class="' . implode(' ', $class) . '"' : ''; |
| 81 | + $title = $this->element['label'] ? (string) $this->element['label'] : ($this->element['title'] ? (string) $this->element['title'] : ''); |
| 82 | + $heading = $this->element['heading'] ? (string) $this->element['heading'] : 'h4'; |
| 83 | + $description = (string) $this->element['description']; |
| 84 | + $html[] = !empty($title) ? '<' . $heading . '>' . Text::_($title) . '</' . $heading . '>' : ''; |
| 85 | + $html[] = !empty($description) ? Text::_($description) : ''; |
79 | 86 |
|
80 | 87 | return '</div><div ' . $class . '>' . implode('', $html); |
81 | 88 | } |
|
0 commit comments