You are here

function _amp_adsense_headers in Accelerated Mobile Pages (AMP) 7

A callback to render amp_ad with js library added to head.

Return value

The passed-in element with the js library necessary for the amp-ad element added to head.

1 call to _amp_adsense_headers()
amp_adsense_preprocess_amp_ad in modules/amp_adsense/amp_adsense.module
Implements hook_preprocess_amp_ad().

File

modules/amp_adsense/amp_adsense.module, line 69
AMP integration for the Adsense module.

Code

function _amp_adsense_headers() {
  $head_js = array(
    '#tag' => 'script',
    '#type' => 'html_tag',
    '#attributes' => array(
      'src' => 'https://cdn.ampproject.org/v0/amp-ad-0.1.js',
      'async' => NULL,
      'custom-element' => 'amp-ad',
    ),
  );
  drupal_add_html_head($head_js, 'amp-ad');
}