Skip to content
Merged
42 changes: 20 additions & 22 deletions layouts/joomla/system/message.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;

$msgList = $displayData['msgList'];
$msgList = $displayData['msgList'];
$msgOutput = '';

$alert = [
CMSApplication::MSG_EMERGENCY => 'danger',
Expand Down Expand Up @@ -43,25 +44,22 @@
->useStyle('webcomponent.joomla-alert')
->useScript('webcomponent.joomla-alert');

if (is_array($msgList) && !empty($msgList)) :
foreach ($msgList as $type => $msgs) :
$msgOutput .= '<joomla-alert type="' . ($alert[$type] ?? $type) . '" dismiss="true">';
if (!empty($msgs)) :
$msgOutput .= '<div class="alert-heading">';
$msgOutput .= '<span class="' . $type . '"></span>';
$msgOutput .= '<span class="sr-only">' . Text::_($type) . '</span>';
$msgOutput .= '</div>';
$msgOutput .= '<div class="alert-wrapper">';
foreach ($msgs as $msg) :
$msgOutput .= '<div class="alert-message">' . $msg . '</div>';
endforeach;
$msgOutput .= '</div>';
endif;
$msgOutput .= '</joomla-alert>';
endforeach;
endif;
?>
<div id="system-message-container" aria-live="polite">
<div id="system-message">
<?php if (is_array($msgList) && !empty($msgList)) : ?>
<?php foreach ($msgList as $type => $msgs) : ?>
<joomla-alert type="<?php echo $alert[$type] ?? $type; ?>" dismiss="true">
<?php if (!empty($msgs)) : ?>
<div class="alert-heading">
<span class="<?php echo $type; ?>"></span>
<span class="sr-only"><?php echo Text::_($type); ?></span>
</div>
<div class="alert-wrapper">
<?php foreach ($msgs as $msg) : ?>
<div class="alert-message"><?php echo $msg; ?></div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</joomla-alert>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<div id="system-message-container" aria-live="polite"><div id="system-message"><?php echo $msgOutput; ?></div></div>