You are here

function dfp_page_build in Doubleclick for Publishers (DFP) 7.2

Same name and namespace in other branches
  1. 7 dfp.module \dfp_page_build()

Implements of hook_page_build().

File

./dfp.module, line 1076

Code

function dfp_page_build(&$page) {
  $html = '';
  $tags = dfp_tag_load_all();
  foreach ($tags as $tag) {
    if (isset($tag->settings['out_of_page']) && $tag->settings['out_of_page'] == TRUE) {
      drupal_alter('dfp_tag_load', $tag);
    }
  }
  if (module_exists('context')) {
    if ($plugin = context_get_plugin('reaction', 'dfp_outofpage')) {
      if (isset($plugin->out_of_page_tags)) {
        foreach ($plugin->out_of_page_tags as $key => $machinename) {
          $tag = dfp_tag_load($machinename);
          if (empty($tag->disabled)) {
            $dfp_tag = dfp_tag($machinename);
            $dfp_tag['dfp_wrapper']['#attributes']['class'][] = 'element-hidden';
            $html .= render($dfp_tag);
          }
        }
      }
    }
  }

  // Add Out Of Page slots on the top of the page.
  $page['page_top']['dfp_out_of_page'] = array(
    '#weight' => -1000,
    '#markup' => $html,
  );
}