@carles.zapater: the Bootstrap 4 toast component is an alert message which JavaScript behavior is initialized in the official documentation with$('.toast').toast(option)
The .toast('show') event is called by$('#element').toast('show')
The Barrio theme is bundled with a twig file located at \templates\misc\status-messages--toasts.html.twig allowing you to customize your toasts.
Toasts is a new feature not present on older versions of Bootstrap 4.x.
This will only appear if you activate toasts, so either update your Bootstrap version o disable toasts.
The real solution is to declare toast library that calls a toast.js, with the line of code inside and not on the global library.
This toast library should be called by the status-messages--toasts.html.twig template.
This way the function will only be called if toast message is required.
Collaborations welcome!!!!
I still get error message in 8.x-4.22 in Drupal 8.6.14 minimal installation:
drupal.js?v=8.6.14:13 Uncaught TypeError: $(...).toast is not a function
at Object.attach (toast.js?v=8.6.14:12)
at drupal.js?v=8.6.14:25
at Array.forEach ()
at Object.Drupal.attachBehaviors (drupal.js?v=8.6.14:22)
at drupal.init.js?v=8.6.14:16
at HTMLDocument.t (ready.min.js?v=1.0.8:4)
In a clean Drupal minimal installation. It can reproduce the issue in theme "Bootstrap Barrio 8.x-4.22" while theme "Bootstrap Barrio Subtheme 8.x-4.22" works fine.
Comments
Comment #2
gillesbailleux@carles.zapater: the Bootstrap 4 toast component is an alert message which JavaScript behavior is initialized in the official documentation with
$('.toast').toast(option)The .toast('show') event is called by
$('#element').toast('show')The Barrio theme is bundled with a twig file located at \templates\misc\status-messages--toasts.html.twig allowing you to customize your toasts.
Comment #3
hatuhay commentedToasts is a new feature not present on older versions of Bootstrap 4.x.
This will only appear if you activate toasts, so either update your Bootstrap version o disable toasts.
Comment #4
hatuhay commentedComment #5
jeroentI disabled toasts in my theme settings, but I still get the same error.
Comment #6
gillesbailleux@JeroenT: by "my theme settings", do you mean
Comment #7
jeroent@gillesbailleux,
I mean through the UI at /admin/appearance/settings/bootstrap_barrio under the Components > Messages tab.
Comment #8
hatuhay commentedThe real solution is to declare toast library that calls a toast.js, with the line of code inside and not on the global library.
This toast library should be called by the status-messages--toasts.html.twig template.
This way the function will only be called if toast message is required.
Collaborations welcome!!!!
Comment #9
hatuhay commentedComment #10
jeroentPatch attached fixes the the problem for me. The toast.js files is only included when toast is configured in the theme settings.
Comment #12
jeroentComment #15
jeroent@PissedOff, some people spend their free time writing code and documentation. So it’s not really nice to act like this.
Comment #16
parijke commentedYou're right Jeroen. I also get frustrated sometimes but then I think how much do I know and how much do I contribute?
I always sets me straight.
To mr. PO I would say: can you do better? Then please do so. The community will be thankfull
Comment #23
hatuhay commentedComment #26
hgneng commentedI still get error message in 8.x-4.22 in Drupal 8.6.14 minimal installation:
In a clean Drupal minimal installation. It can reproduce the issue in theme "Bootstrap Barrio 8.x-4.22" while theme "Bootstrap Barrio Subtheme 8.x-4.22" works fine.
Comment #27
hgneng commentedI create a new ticket for issue of comment #26: https://www.drupal.org/project/bootstrap_barrio/issues/3051333