function get_amp_sticky_ad in Accelerated Mobile Pages (AMP) 7
Returns the sticky ad element. Ensures that only one sticky ad is placed on the page to avoid validation errors.
@params $tag The ad tag.
Return value
$sticky_ad The sticky ad.
1 call to get_amp_sticky_ad()
- amp_dfp_preprocess_amp_dfp_tag in modules/
amp_dfp/ amp_dfp.module - Implements hook_preprocess_amp_dfp_tag().
File
- modules/
amp_dfp/ amp_dfp.module, line 275 - AMP integration for the DFP module.
Code
function get_amp_sticky_ad($tag) {
static $count;
$sticky_ad = array();
if (is_null($count)) {
$sticky_ad['layout'] = NULL;
$sticky_ad['sticky'] = TRUE;
$sticky_ad['slot'] = '/' . trim($tag->adunit, '/') . '/sticky';
$count++;
}
else {
watchdog('amp_dfp', 'DFP tag %machinename is being added to the page more than once.', array(
'%machinename' => $tag->machinename,
), WATCHDOG_WARNING);
}
return $sticky_ad;
}