Module preloads javascript from Bootstrap version 3 CDN crashing with themes using Bootstrap 4.

Comments

VladimirAus created an issue. See original summary.

thalles’s picture

Hi @VladimirAus, all raight?
Can you check, settings for not load the Bootstrap js on /admin/config/user-interface/modal-page/settings

renatog’s picture

Category: Bug report » Support request
Status: Active » Reviewed & tested by the community

Yes, if you're using the Bootstrap Library you just need to mark an option (checkbox) to avoid load Modal Page's JavaScript.

renatog’s picture

Status: Reviewed & tested by the community » Fixed

@vladimiraus the #2 it's correct.

Please let us know with words good for you.

Thank you so much.

vladimiraus’s picture

Thanks @thalles @RenatoG.
I'm using bootstrap4 theme and it broke my site by loading both bootstrap 3 and bootstrap 4.
I removed the module as a result.
Maybe there should be a message to indicate that extra library is being used similar to what webforms do when you install them.

thalles’s picture

You can disable load of js of the bootstrap 3 on module settings on /admin/config/user-interface/modal-page/settings,

Can you tests this for us?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

renatog’s picture

#5 it's a good idea.

We can create a message to notify users to uncheck this checkbox if are using bootstrap.

#3076326: Notify users to uncheck library checkbox if are using bootstrap

What do you think @thalles?

Thanks for idea @vladimiraus

jncruces’s picture

I think that this issue must be reopened because the user not respond but the issue persist.

If you have an external bootstrap library the system reload it twice with some inconsistencies on the workflow.

The solution of uncheck the external library not working because there are a direct dependence between the local javascript of the module and the bootstrap library.

In my patch i separated both and created the logic in the modal_page.module to load separately.

renatog’s picture

Version: 8.x-2.4 » 8.x-2.x-dev
Category: Support request » Bug report
Status: Closed (fixed) » Needs review

Very good @jncruces

I check your patch and really makes sense!

Changing the issue status to needs review, but looks well for me.

Thank you so much for your help!

renatog’s picture

Status: Needs review » Reviewed & tested by the community

I applied the patch and really works well!

Good catch, @jncruces! Thank you very much!

P.s. I just changed a little detail.

From

if (!empty($modal_exists) && !$no_modal_page_external_js) {
  $attachments['#attached']['library'][] = 'modal_page/modal-page-bootstrap';
}
if (!empty($modal_exists)) {
  $attachments['#attached']['library'][] = 'modal_page/modal-page';
}

To:

if (!empty($modal_exists)) {
  $attachments['#attached']['library'][] = 'modal_page/modal-page';

  if (!$no_modal_page_external_js) {
    $attachments['#attached']['library'][] = 'modal_page/modal-page-bootstrap';
  }
}

Okay?

  • RenatoG committed dabb55e on 8.x-2.x authored by jncruces
    Issue #3068319 by jncruces, RenatoG, VladimirAus, thalles: Module...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Committed to the dev version.

We'll put on the new release soon.

Tks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.