mecha-cms / mecha

Minimalist content management system.
https://mecha-cms.com
GNU General Public License v3.0
178 stars 23 forks source link

Class-Less Alert Extension #176

Closed taufik-nurrohman closed 2 years ago

taufik-nurrohman commented 2 years ago

Remove class names from the generated alert HTML markup and replace it with attribute role="alert". Default alert markup don’t have to care with the alert type. It’s up to the layout maker. It can be made specific via .\lot\layout\alert.php file by iterating over the array output of alert():

<?php foreach (alert() as $v): ?>
  <p class="alert alert-<?= $v[2]['type']; ?>" role="alert">
    <?= $v[1]; ?>
  </p>
<?php endforeach; ?>

Reference: https://www.w3.org/TR/wai-aria-1.1/#alert

Related: https://github.com/mecha-cms/mecha/discussions/174