_drupal_add_js
- Versions
- 5
_drupal_add_js($data, $type, $scope, $defer, $cache)
Helper function for drupal_add_js().
Related topics
Code
includes/common.inc, line 1760
<?php
function _drupal_add_js($data, $type, $scope, $defer, $cache) {
static $javascript = array();
if (!isset($javascript[$scope])) {
$javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array());
}
if (!isset($javascript[$scope][$type])) {
$javascript[$scope][$type] = array();
}
if (!is_null($data)) {
switch ($type) {
case 'setting':
$javascript[$scope][$type][] = $data;
break;
case 'inline':
$javascript[$scope][$type][] = array('code' => $data, 'defer' => $defer);
break;
default:
$javascript[$scope][$type][$data] = array('cache' => $cache, 'defer' => $defer);
}
}
return $javascript[$scope];
}
?>Login or register to post comments 