[development] Drupal 7 API Change notification: JavaScript loading techniques (use drupal_add_library())
Randy Fay
randy at randyfay.com
Mon Dec 13 02:16:33 UTC 2010
Looking through the patch in
#12<http://drupal.org/node/954804#comment-3751412>,
I see:
+ $libraries['drupal.ajax'] = array(
+ 'js' => array(
+ 'misc/ajax.js' => array('group' => JS_LIBRARY, 'weight' => 2),
+ ),
+ 'dependencies' => array(
+ array('system', 'drupal.progress'),
+ ),
+ );
+
+ // Drupal's batch API.
+ $libraries['drupal.batch'] = array(
+ 'title' => 'Drupal batch API',
+ 'version' => VERSION,
+ 'js' => array(
+ 'misc/batch.js' => array('cache' => FALSE),
+ ),
+ 'dependencies' => array(
+ array('system', 'drupal.progress'),
+ ),
+ );
+
+ // Drupal's progress indicator.
+ $libraries['drupal.progress'] = array(
+ 'title' => 'Drupal progress indicator',
+ 'version' => VERSION,
+ 'js' => array(
+ 'misc/progress.js' => array('cache' => FALSE),
+ ),
+ );
+
+ // Drupal's form library.
+ $libraries['drupal.form'] = array(
+ 'title' => 'Drupal form library',
+ 'version' => VERSION,
+ 'js' => array(
+ 'misc/form.js' => array('group' => JS_LIBRARY, 'weight' => 1),
+ ),
+ );
+
+ // Drupal's states library.
+ $libraries['drupal.states'] = array(
+ 'title' => 'Drupal states',
+ 'version' => VERSION,
+ 'js' => array(
+ 'misc/states.js' => array('group' => JS_LIBRARY, 'weight' => 1),
+ ),
+ );
+
+ // Drupal's collapsible fieldset.
+ $libraries['drupal.collapse'] = array(
+ 'title' => 'Drupal collapsible fieldset',
+ 'version' => VERSION,
+ 'js' => array(
+ 'misc/collapse.js' => array(),
+ ),
+ 'dependencies' => array(
+ // collapse.js relies on drupalGetSummary in form.js
+ array('system', 'drupal.form'),
+ ),
+ );
+
+ // Drupal's resizable textarea.
+ $libraries['drupal.textarea'] = array(
+ 'title' => 'Drupal resizable textarea',
+ 'version' => VERSION,
+ 'js' => array(
+ 'misc/textarea.js' => array(),
+ ),
+ );
+
+ // Drupal's autocomplete widget.
+ $libraries['drupal.autocomplete'] = array(
+ 'title' => 'Drupal autocomplete',
+ 'version' => VERSION,
+ 'js' => array(
+ 'misc/autocomplete.js' => array(),
+ ),
+ );
+
// jQuery.
$libraries['jquery'] = array(
'title' => 'jQuery',
@@ -1087,7 +1170,7 @@ function system_library() {
);
// jQuery Once.
- $libraries['once'] = array(
+ $libraries['jquery.once'] = array(
'title' => 'jQuery Once',
'website' => 'http://plugins.jquery.com/project/once',
'version' => '1.2',
@@ -1097,7 +1180,7 @@ function system_library() {
);
// jQuery Form Plugin.
- $libraries['form'] = array(
+ $libraries['jquery.form'] = array(
'title' => 'jQuery Form Plugin',
'website' => 'http://malsup.com/jquery/form/',
'version' => '2.49',
@@ -1107,7 +1190,7 @@ function system_library() {
);
// jQuery BBQ plugin.
- $libraries['jquery-bbq'] = array(
+ $libraries['jquery.bbq'] = array(
'title' => 'jQuery BBQ',
'website' => 'http://benalman.com/projects/jquery-bbq-plugin/',
'version' => '1.2.1',
@@ -1117,7 +1200,7 @@ function system_library() {
);
// Vertical Tabs.
- $libraries['vertical-tabs'] = array(
+ $libraries['drupal.vertical-tabs'] = array(
'title' => 'Vertical Tabs',
'website' => 'http://drupal.org/node/323112',
'version' => '1.0',
@@ -1127,6 +1210,10 @@ function system_library() {
'css' => array(
'misc/vertical-tabs.css' => array(),
),
+ 'dependencies' => array(
+ // Vertical tabs relies on drupalGetSummary in form.js
+ array('system', 'drupal.form'),
+ ),
);
// Farbtastic.
@@ -1143,7 +1230,7 @@ function system_library() {
);
// Cookie.
- $libraries['cookie'] = array(
+ $libraries['jquery.cookie'] = array(
'title' => 'Cookie',
'website' => 'http://plugins.jquery.com/project/cookie',
'version' => '1.0',
@@ -1533,6 +1620,15 @@ function system_library() {
),
);
+ // These library names are deprecated. Earlier versions of Drupal 7 didn't
+ // consistently namespace their libraries, so these names are included for
+ // backwards compatibility with those versions.
+ $libraries['once'] = &$libraries['jquery.once'];
+ $libraries['form'] = &$libraries['jquery.form'];
+ $libraries['jquery-bbq'] = &$libraries['jquery.bbq'];
+ $libraries['vertical-tabs'] = &$libraries['drupal.vertical-tabs'];
+ $libraries['cookie'] = &$libraries['jquery.cookie'];
+
return $libraries;
}
On Sun, Dec 12, 2010 at 2:34 PM, Michael Prasuhn <mike at mikeyp.net> wrote:
> On Dec 12, 2010, at 1:22 PM, Randy Fay wrote:
> > (issue) Contrib modules should not use drupal_add_js() for core
> JavaScript files (which are all now packaged as libraries).
>
> Which files are affected by this?
>
> -Mike
> __________________
> Michael Prasuhn
> mike at mikeyp.net
> http://mikeyp.net
>
>
--
Randy Fay
Drupal Module and Site Development
randy at randyfay.com
+1 970.462.7450
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20101212/08a92a1c/attachment.html
More information about the development
mailing list