Commit 5c4e64ca authored by Pieter Frenssen's avatar Pieter Frenssen Committed by Alberto Siles
Browse files

Issue #3246463 by pfrenssen: Toasts not working in Bootstrap 5

parent 1b8e30ee
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -174,6 +174,8 @@ toast:
  version: VERSION
  js:
    js/toast.js: {}
  dependencies:
    - bootstrap_barrio/bootstrap_js

verticaltabs:
  version: VERSION
+9 −8
Original line number Diff line number Diff line
/**
 * @file
 * Toast utilities.
 *
 * Displays any toast messages present on the page.
 */
(function ($, Drupal) {

(function (Drupal) {
  'use strict';

  Drupal.behaviors.bootstrap_barrio_toast = {
    attach: function (context, settings) {
      $('.toast').toast('show');
    attach: function () {
      var elements = [].slice.call(document.querySelectorAll('.toast'))
      var toasts = elements.map(function(toastEl) {
        return new bootstrap.Toast(toastEl);
      });
      toasts.forEach(toast => toast.show());
    }
  };

})(jQuery, Drupal);
})(Drupal);