Commit 7f18fd07 authored by webchick's avatar webchick
Browse files

#273162: Allow leniency in jquery_ui_add()'s function arguments to allow for single files.

parent f0e07954
......@@ -67,6 +67,8 @@ the following changes:
For example:
jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable'));
jquery_ui_add('ui.sortable'); // For a single file
See the contents of the jquery.ui-X.X sub-directory for a list of available
files that may be included, and see http://ui.jquery.com/docs for details on
......
......@@ -16,11 +16,14 @@
define('JQUERY_UI_PATH', drupal_get_path('module', 'jquery_ui') . '/jquery.ui');
/**
* Add JQuery interface library to this page.
* Add the specified jQuery UI library files to this page.
*
* The ui.core file is always included automatically, as well as the
* effects.core file if any of the effects libraries are used.
*
* @param $files
* An array of what additional files (other than UI core) should be loaded
* on the page.
* on the page, or a string with a single file name.
* @param $type
* Compression type: leave empty to use admin setting.
* Possible values: 'minified', 'packed', 'none'
......@@ -29,6 +32,12 @@ function jquery_ui_add($files = array(), $type = NULL) {
static $loaded_files, $ui_core, $effects_core;
$jquery_ui_path = JQUERY_UI_PATH . '/ui';
// Convert file to an array if it's not one already, to compensate for
// lazy developers. ;)
if (!is_array($files)) {
$files = array($files);
}
// If a type wasn't specified, then default to whatever was specified in the
// settings page.
if (is_null($type)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment