Skip to content

Commit 0f0caaa

Browse files
Merge pull request #219 from drupalprojects/7.x-3.x1-js-weight
Make sure Bootstrap js loads after jQuery but before jQuery UI
2 parents 7120748 + 87196e4 commit 0f0caaa

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

template.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,15 @@ function kalatheme_process_page(&$variables) {
116116
if (!kalatheme_use_libraries()) {
117117
$library = theme_get_setting('bootstrap_library');
118118
if ($library !== 'none' && !empty($library)) {
119-
// Add the JS
120-
drupal_add_js($base['scheme'] . ":" . KALATHEME_BOOTSTRAP_JS, 'external');
119+
// Add the JS. Note that we have to put Bootstrap after jQuery, but before jQuery UI.
120+
$url = $base['scheme'] . ":" . KALATHEME_BOOTSTRAP_JS;
121+
$jquery_ui_library = drupal_get_library('system', 'ui');
122+
$jquery_ui_js = reset($jquery_ui_library['js']);
123+
drupal_add_js($url, array(
124+
'type' => 'external',
125+
'group' => JS_LIBRARY,
126+
'weight' => $jquery_ui_js['weight'] - 1,
127+
));
121128

122129
// Add the CSS
123130
if ($library == 'default') {

0 commit comments

Comments
 (0)