Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.732
diff -u -r1.732 common.inc
--- includes/common.inc 7 Dec 2007 11:14:05 -0000 1.732
+++ includes/common.inc 7 Dec 2007 15:36:16 -0000
@@ -1868,6 +1868,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
@@ -1882,13 +1885,14 @@
* (optional) If given, the value depends on the $type parameter:
* - 'core', 'module' or 'theme': Path to the file relative to base_path().
* - 'inline': The JavaScript code that should be placed in the given scope.
+ * - 'external': The absolute URL of a JavaScript resource.
* - 'setting': An array with configuration options as associative array. The
* array is directly placed in Drupal.settings. You might want to wrap your
* actual configuration settings in another variable to prevent the pollution
* 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
@@ -1922,12 +1926,12 @@
'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])) {
@@ -2002,9 +2006,16 @@
foreach ($javascript as $type => $data) {
- if (!$data) continue;
+ if (!$data) {
+ continue;
+ }
switch ($type) {
+ case 'external':
+ foreach ($data as $path => $info) {
+ $output .= '\n";
+ }
+ break;
case 'setting':
$output .= '\n";
break;