function template_preprocess_adsense_ad in Google AdSense integration 8
Implements template_preprocess_HOOK().
File
- ./
adsense.module, line 181 - Displays Google AdSense ads on Drupal pages.
Code
function template_preprocess_adsense_ad(&$variables) {
$variables['adclasses'][] = 'adsense';
if (!empty($variables['format']) && (empty($variables['width']) || empty($variables['height']))) {
list($variables['width'], $variables['height']) = ContentAdBase::dimensions($variables['format']);
}
if (empty($variables['content'])) {
$variables['content'] = '<-- empty ad content -->';
}
if (!empty($variables['width']) && !empty($variables['height'])) {
$variables['style'] = "width:{$variables['width']}px;height:{$variables['height']}px;";
}
else {
$variables['adclasses'][] = 'responsive';
}
$variables['classes'] = implode(' ', $variables['classes']);
$variables['adclasses'] = implode(' ', $variables['adclasses']);
}