function google_admanager_get_js in DFP Small Business (Google Ad Manager) 6.3
Same name and namespace in other branches
- 6 google_admanager.module \google_admanager_get_js()
- 6.2 google_admanager.module \google_admanager_get_js()
- 7.2 google_admanager.module \google_admanager_get_js()
Output the Google Admanager scripts by way of drupal_add_js().
Parameters
$scope (optional) the scope to output the javascript. see: drupal_add_js().
1 call to google_admanager_get_js()
- google_admanager_preprocess_page in ./
google_admanager.module - Implementation of hook_preprocess_page().
File
- ./
google_admanager.module, line 212
Code
function google_admanager_get_js($scope = 'header') {
//get the js for this page if it exists
$ga_js = google_admanager_add_js();
$data = array();
if (isset($ga_js)) {
$output_order = array(
'init',
'service',
'attr',
'slot',
'close',
);
foreach ($output_order as $type) {
if (empty($ga_js[$type])) {
continue;
}
$output = '';
foreach ($ga_js[$type] as $js) {
$output .= $js . "\n";
}
if (variable_get('google_admanager_noheader', FALSE)) {
$script = drupal_get_js($scope, array(
'inline' => array(
array(
'code' => trim($output),
'defer' => FALSE,
),
),
));
$data[$type] = $script;
}
else {
drupal_add_js($output, 'inline', $scope);
}
}
}
return $data;
}