1

Using the jQuery Update module, I set version 1.8. This version "broke" the views UI in the Admin theme; it seems that the AJAX calls in the Views UI work only with jquery 1.5.

How can I fix it?

4 Answers 4

1

With jQuery Update 7.x-3.0-alpha2 and later, there is a setting that allows to change the jQuery used for a specific theme; you can select:

  • The site default version (set with the jQuery Update module)
  • The version that comes with Drupal
  • Any version supported by the jQuery Update module

screenshot

0

try this

/**
 * Implements hook_module_implements_alter().
 */
function mymodule_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'library_alter') {
    if(isset($implementations['jquery_update'])) { 
      // Move jquery update to the end. This will make sure our hook_library_alter
      // is always called before the jquery_update.
      $jquery_update = $implementations['jquery_update'];
      unset($implementations['jquery_update']);
      $implementations['jquery_update'] = $jquery_update;
    }
  }
}

/**
 * Implements hook_library_alter().
 */
function mymodule_library_alter(&$libraries, $module) {
  // If it is the admin theme all we want to do is change the global $conf
  // variable so when jquery_update runs right after us it will use 1.5.
  // We are not using path_is_admin(current_path()) because some admin path can use
  // the frontend theme like node edit page
  global $theme_key;
  if (variable_get('admin_theme') == $theme_key) {
    // Modifying global $conf variable, can be dangerous. Be carefull.
    global $conf;
    $conf['jquery_update_jquery_version'] = '1.5';
  }
}

from http://antistatique.net/blog/2013/01/04/drupal-use-a-different-jquerys-version-for-the-frontend-and-backend/

0

You can use my patch from this issue. It will add per path settings, like on the following mockup:

mockup

Patch code here, and also below:

*** jquery_update.module    Fri Sep 28 01:53:48 2012
--- jquery_update.module    Tue Oct 08 11:12:58 2013
***************
*** 68,77 ****
--- 68,83 ----
    // We are updating just the system module. For all other cases we return.
    if ($module != 'system') {
      return;
    }

+   // We don't want to alter if we are on one of the excluded paths
+   if(drupal_match_path(current_path(), variable_get('jquery_update_exclude_paths', ''))) {
+     return;
+   }
+       
+       
    $path = drupal_get_path('module', 'jquery_update');

    // Make sure we inject either the minified or uncompressed version as desired.
    $min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min';
    $cdn = variable_get('jquery_update_jquery_cdn', 'none');
***************
*** 146,155 ****
--- 152,167 ----
        'microsoft' => t('Microsoft'),
        'jquery' => t('jQuery'),
      ),
      '#default_value' => variable_get('jquery_update_jquery_cdn', 'none'),
      '#description' => t('Use jQuery and jQuery UI from a CDN. If the CDN is not available the local version of jQuery and jQuery UI will be used.'),
+   );
+   $form['jquery_update_exclude_paths'] = array(
+     '#type' => 'textarea',
+     '#title' => t('Disable jQuery update on the following paths'),
+     '#description' => t('You are allowed to use wildcards, for example admin/*'),
+     '#default_value' => variable_get('jquery_update_exclude_paths', ''),
    );

    return system_settings_form($form);
  }
0

Use dev version, that has already commited patch allowing to set different version for administrative pages: https://drupal.org/node/1524944

1
  • Sadly, it still does not allow to use original jQuery version to be selected. This issue is still open.
    – Mołot
    Commented Nov 22, 2013 at 11:13

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.