You are here

function simplemeta_preprocess_html in Simple Meta 7

Same name and namespace in other branches
  1. 8.2 simplemeta.module \simplemeta_preprocess_html()
  2. 8 simplemeta.module \simplemeta_preprocess_html()
  3. 7.2 simplemeta.module \simplemeta_preprocess_html()

Implements $module_preprocess_$hook().

File

./simplemeta.module, line 145
SimpleMeta module.

Code

function simplemeta_preprocess_html(&$vars) {
  global $language;
  if ($meta = simplemeta_get_page_meta($_GET['q'], $language->language)) {

    // Set page title.
    if (!empty($meta->data['title'])) {
      if (module_exists('token')) {
        $meta->data['title'] = token_replace($meta->data['title']);
      }
      $vars['head_title'] = check_plain($meta->data['title']);
    }
    foreach ($meta->view as $key => $item) {
      if (module_exists('token')) {
        $item = token_replace($item);
      }
      $head_item = array(
        '#type' => 'markup',
        '#markup' => $item,
      );
      drupal_add_html_head($head_item, 'simplemeta_' . $key);
    }
  }
}