function theme_adsense_ad in Google AdSense integration 7
Same name and namespace in other branches
- 5.3 adsense.module \theme_adsense_ad()
- 6 adsense.module \theme_adsense_ad()
Default AdSense ad unit theming.
Simply add a div with the adsense and $module classes.
Parameters
array $vars: Array elements: 'ad': string with the generated ad unit. 'module': module used to generate the ad.
Return value
string Modified ad unit
1 theme call to theme_adsense_ad()
- adsense_display in ./
adsense.module - Generates the Google AdSense Ad.
File
- ./
adsense.module, line 584 - Displays Google AdSense ads on Drupal pages.
Code
function theme_adsense_ad(array $vars) {
$style = '';
$adclasses = 'adsense';
if (isset($vars['format'])) {
if (_adsense_is_responsive($vars['format']) || _adsense_is_fluid($vars['format'])) {
$adclasses .= ' responsive';
}
else {
$ad_fmt = _adsense_dimensions($vars['format']);
$style = "style='width:{$ad_fmt['width']}px;height:{$ad_fmt['height']}px;'";
}
}
return "<div class='{$adclasses}' {$style}>\n{$vars['ad']}\n</div>";
}