function theme_google_admanager_block in DFP Small Business (Google Ad Manager) 7.2
Same name and namespace in other branches
- 5 google_admanager.module \theme_google_admanager_block()
- 6 google_admanager.module \theme_google_admanager_block()
- 6.2 google_admanager.module \theme_google_admanager_block()
Theme function the Ad Slot code
2 theme calls to theme_google_admanager_block()
- google_admanager_block_view in ./
google_admanager.module - Implements hook_block_view().
- _google_admanager_substitute_tags in ./
google_admanager.module - Replace all Admanager tags with their corresponding files or images.
File
- ./
google_admanager.module, line 253
Code
function theme_google_admanager_block($variables) {
$id = $variables['id'];
$ad_slot = $variables['ad_slot'];
$script = '<script type="text/javascript">GA_googleFillSlot("' . $ad_slot . '");</script>';
if ($variables['cache']) {
$script = '<script type="text/javascript">GA_googleAddSlot("' . $id . '", "' . $ad_slot . '");</script>' . $script;
}
else {
google_admanager_add_js('GA_googleAddSlot("' . $id . '", "' . $ad_slot . '");');
}
$style = '';
if (variable_get('google_admanager_lazy', FALSE)) {
// if ad slot name has the format some-name_widthxheight_something,
// set the div dimension
if (variable_get('google_admanager_autodetect', FALSE)) {
if (preg_match('/(\\d+)x(\\d+)(_.*|)$/', $ad_slot, $match)) {
$style = ' style="width:' . $match[1] . 'px;height:' . $match[2] . 'px;"';
}
}
google_admanager_add_block('<div id="gam-content-' . $ad_slot . '" class="gam-banner">' . $script . '</div>');
$script = '';
}
return '<div id="gam-holder-' . $ad_slot . '" class="gam-holder"' . $style . '>' . $script . '</div>';
}