You are here

function metatag_context_page_alter in Metatag 7

Implements hook_page_alter().

File

metatag_context/metatag_context.module, line 96
Primary hook implementations for Metatag Context.

Code

function metatag_context_page_alter(&$page) {

  // By default do not add meta tags to admin pages. To enable meta tags on
  // admin pages set the 'metatag_tag_admin_pages' variable to TRUE.
  if (path_is_admin(current_path()) && !variable_get('metatag_tag_admin_pages', FALSE)) {
    return;
  }

  // Load the meta tags that have been generated for this page.
  $metatags = drupal_static('metatag_context', array());
  if (!empty($metatags)) {

    // The page region can be changed.
    $region = variable_get('metatag_page_region', 'content');
    $page[$region]['metatags']['context'] = $metatags;
  }
}