You are here

function advagg_get_full_js in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 7.2 advagg.module \advagg_get_full_js()

Get full JS array.

Note that hook_js_alter(&$javascript) is called during this function call to allow alterations of the JavaScript during its presentation. Calls to drupal_add_js() from hook_js_alter() will not be added to the output presentation. The correct way to add JavaScript during hook_js_alter() is to add another element to the $javascript array, deriving from drupal_js_defaults(). See locale_js_alter() for an example of this.

Parameters

$javascript: (optional) An array with all JavaScript code. Defaults to the default JavaScript array for the given scope.

$skip_alter: (optional) If set to TRUE, this function skips calling drupal_alter() on $javascript, useful when the calling function passes a $javascript array that has already been altered.

Return value

The raw JavaScript array.

See also

drupal_add_js()

locale_js_alter()

drupal_js_defaults()

File

./advagg.module, line 367
Advanced CSS/JS aggregation module

Code

function advagg_get_full_js($javascript = NULL, $skip_alter = FALSE) {
  if (!isset($javascript)) {
    $javascript = drupal_add_js();
  }
  if (empty($javascript)) {
    return FALSE;
  }

  // Allow modules to alter the JavaScript.
  if (!$skip_alter) {
    drupal_alter('js', $javascript);
  }
  return $javascript;
}