1

I'm a newbie to drupal 7, And I'm facing a conflict between jquery.ui.button.js and bootstrap/button.js because jquery ui is loaded before bootstrap. How can I change the order and load jquery ui last?

Knowing that bootstrap files are loaded by the theme, and jQuery UI is loaded by the module (jquery_update)

2
  • Which version of Drupal, 7 or 8?
    – CG Monroe
    Mar 25, 2019 at 14:56
  • It's 7 as mentioned in the question
    – Ahmed
    Mar 26, 2019 at 11:45

1 Answer 1

0

There are a couple of ways in Drupal 7 to control load/execution order. The simplest is to change the module weight in the system table to get the right order. Unfortunately, this will not work in this case since there is a module and theme involved. Themes always get executed after modules (so UI changes are ensured to happen and not be overwritten).

This means you will probably have to write some code in order to modify the load order. In your [theme.module] file, you will need to implement the Drupal hook: hook_js_alter. E.g. add a function my_theme_js_alter(&$javascript) to the theme module file.

You will probably need to install devel and use dpm to dump the javascript array. You can then use this information to rearrange the load order as you need it. Probably just unset the jquery_ui entry and add it to the array at the bottom.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.