Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.759
diff -u -r1.759 common.inc
--- includes/common.inc 20 Feb 2008 13:38:32 -0000 1.759
+++ includes/common.inc 28 Feb 2008 05:52:05 -0000
@@ -1894,6 +1894,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
@@ -1908,13 +1911,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
@@ -1951,6 +1955,7 @@
),
'module' => array(),
'theme' => array(),
+ 'external' => array(),
'setting' => array(
array('basePath' => base_path()),
),
@@ -1959,7 +1964,7 @@
}
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])) {
@@ -2041,9 +2046,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;