function jquery_update_jqueryui_replace in jQuery Update 7.3
Same name and namespace in other branches
- 7.2 jquery_update.module \jquery_update_jqueryui_replace()
Update jQuery UI to the CDN or local path.
Parameters
array $javascript: The library definition array as seen in hook_library_alter().
string $cdn: The name of the CDN option to use. Possible options are:
- none
- microsoft
string $path: The path to the module where replacements can be found.
string $min: The '.min' to include in the file name if we are requesting a minified version.
1 call to jquery_update_jqueryui_replace()
- jquery_update_library_alter in ./
jquery_update.module - Implements hook_library_alter().
File
- ./
jquery_update.module, line 476 - Updates Drupal to use the latest version of jQuery.
Code
function jquery_update_jqueryui_replace(&$javascript, $cdn, $path, $min) {
// Add new components
$javascript['ui.menu'] = array(
'title' => 'jQuery UI: Menu',
'website' => 'http://jqueryui.com/demos/menu/',
'version' => '1.10.2',
'js' => array(
'misc/ui/jquery.ui.menu.min.js' => array(),
),
'css' => array(
'misc/ui/jquery.ui.menu.css' => array(),
),
'dependencies' => array(
array(
'system',
'ui.widget',
),
array(
'system',
'ui.position',
),
),
);
$javascript['ui.spinner'] = array(
'title' => 'jQuery UI: Spinner',
'website' => 'http://jqueryui.com/demos/spinner/',
'version' => '1.10.2',
'js' => array(
'misc/ui/jquery.ui.spinner.min.js' => array(),
),
'css' => array(
'misc/ui/jquery.ui.spinner.css' => array(),
),
'dependencies' => array(
array(
'system',
'ui.widget',
),
array(
'system',
'ui.button',
),
),
);
$javascript['ui.tooltip'] = array(
'title' => 'jQuery UI: Spinner',
'website' => 'http://jqueryui.com/demos/tooltip/',
'version' => '1.10.2',
'js' => array(
'misc/ui/jquery.ui.tooltip.min.js' => array(),
),
'css' => array(
'misc/ui/jquery.ui.tooltip.css' => array(),
),
'dependencies' => array(
array(
'system',
'ui.widget',
),
array(
'system',
'ui.position',
),
),
);
// fix dependencies
$javascript['ui.autocomplete']['dependencies'][] = array(
'system',
'ui.menu',
);
// Replace all CSS files.
$names = drupal_map_assoc(array(
'ui.accordion',
'ui.autocomplete',
'ui.button',
'ui.datepicker',
'ui.dialog',
'ui.progressbar',
'ui.resizable',
'ui.selectable',
'ui.slider',
'ui.tabs',
'ui.menu',
'ui.spinner',
'ui.tooltip',
));
$names['ui'] = 'ui.core';
$csspath = $path . '/replace/ui/themes/base/' . ($min == '.min' ? 'minified/' : '');
foreach ($names as $name => $file) {
$javascript[$name]['css']["misc/ui/jquery.{$file}.css"]['data'] = $csspath . 'jquery.' . $file . $min . '.css';
}
// Make sure ui.theme is replaced as well.
$javascript['ui']['css']['misc/ui/jquery.ui.theme.css']['data'] = $csspath . 'jquery.ui.theme' . $min . '.css';
// Replace jQuery UI's JavaScript, beginning by defining the mapping.
$names = drupal_map_assoc(array(
'ui.accordion',
'ui.autocomplete',
'ui.button',
'ui.datepicker',
'ui.dialog',
'ui.draggable',
'ui.droppable',
'ui.mouse',
'ui.position',
'ui.progressbar',
'ui.resizable',
'ui.selectable',
'ui.slider',
'ui.sortable',
'ui.tabs',
'ui.widget',
'ui.spinner',
'ui.menu',
'ui.tooltip',
));
$names['ui'] = 'ui.core';
$names['effects'] = array(
'effects.core',
'ui.effect',
);
// map[library_hook] = array(core_fn, updated_fn)
$names = jquery_update_make_library_hook_to_file_name_segment_map_for_effects($names);
switch ($cdn) {
case 'google':
$cdn = '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui' . $min . '.js';
jquery_update_jqueryui_cdn($cdn, $javascript, $path, $min, $names);
jquery_update_jqueryui_backup($javascript, $path, $min);
break;
case 'microsoft':
$cdn = '//ajax.aspnetcdn.com/ajax/jquery.ui/1.10.2/jquery-ui' . $min . '.js';
jquery_update_jqueryui_cdn($cdn, $javascript, $path, $min, $names);
jquery_update_jqueryui_backup($javascript, $path, $min);
break;
case 'jquery':
$cdn = '//code.jquery.com/ui/1.10.2/jquery-ui' . $min . '.js';
jquery_update_jqueryui_cdn($cdn, $javascript, $path, $min, $names);
jquery_update_jqueryui_backup($javascript, $path, $min);
break;
case 'none':
jquery_update_jqueryui_local($javascript, $path, $min, $names);
break;
}
}