Index: common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.652
diff -u -r1.652 common.inc
--- common.inc 8 Jun 2007 12:51:58 -0000 1.652
+++ common.inc 9 Jun 2007 14:44:05 -0000
@@ -1647,6 +1647,9 @@
* 'theme' so that files, that are added later, can override previously added
* files with ease.
*
+ * - Add an external file ('external'):
+ * Adds a reference to an external JavaScript file to the page.
+ *
* - Add inline JavaScript code ('inline'):
* Executes a piece of JavaScript code on the current page by placing the code
* directly in the page. This can, for example, be useful to tell the user that
@@ -1660,6 +1663,7 @@
* @param $data
* (optional) If given, the value depends on the $type parameter:
* - 'core', 'module' or 'theme': Path to the file relative to base_path().
+ * - 'external': An array with absolute URLs of JavaScript resources.
* - 'inline': The JavaScript code that should be placed in the given scope.
* - 'setting': An array with configuration options as associative array. The
* array is directly placed in Drupal.settings. You might want to wrap your
@@ -1667,7 +1671,7 @@
* of the Drupal.settings namespace.
* @param $type
* (optional) The type of JavaScript that should be added to the page. Allowed
- * values are 'core', 'module', 'theme', 'inline' and 'setting'. You
+ * values are 'core', 'module', 'theme', 'inline', 'external' and 'setting'. You
* can, however, specify any value. It is treated as a reference to a JavaScript
* file. Defaults to 'module'.
* @param $scope
@@ -1699,11 +1703,11 @@
'misc/jquery.js' => array('cache' => TRUE, 'defer' => FALSE, 'preprocess' => TRUE),
'misc/drupal.js' => array('cache' => TRUE, 'defer' => FALSE, 'preprocess' => TRUE),
),
- 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array(),
+ 'module' => array(), 'theme' => array(), 'external' => array(), 'setting' => array(), 'inline' => array(),
);
}
if (isset($scope) && !isset($javascript[$scope])) {
- $javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array());
+ $javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'external' => array(), 'setting' => array(), 'inline' => array());
}
if (isset($type) && isset($scope) && !isset($javascript[$scope][$type])) {
@@ -1771,7 +1775,9 @@
foreach ($javascript as $type => $data) {
- if (!$data) continue;
+ if (!$data) {
+ continue;
+ }
switch ($type) {
case 'setting':
@@ -1787,7 +1793,7 @@
// Additionally, go through any remaining scripts if JS preprocessing is on and output the non-cached ones.
foreach ($data as $path => $info) {
if (!$info['preprocess'] || !$is_writable || !$preprocess_js) {
- $no_preprocess[$type] .= '\n";
+ $no_preprocess[$type] .= '\n";
}
else {
$files[$path] = $info;