You are here

function vartheme_preprocess_html in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 7.3

Implements hook_preprocess_html().

Most of this code is from zen theme, written by JohnAlbin.

See also

html.tpl.php

File

themes/vartheme/templates/system/html.vars.php, line 9

Code

function vartheme_preprocess_html(&$variables, $hook) {
  global $theme_path, $base_path, $theme;

  // Attributes for html element.
  $variables['html_attributes_array'] = array(
    'lang' => $variables['language']->language,
    'dir' => $variables['language']->dir,
    'class' => array(
      drupal_html_class($theme),
    ),
  );

  // Send X-UA-Compatible HTTP header to force IE to use the most recent
  // rendering engine or use Chrome's frame rendering engine if available.
  // This also prevents the IE compatibility mode button to appear when using
  // conditional classes on the html tag.
  if (is_null(drupal_get_http_header('X-UA-Compatible'))) {
    drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
  }

  // Return early, so the maintenance page does not call any of the code below.
  if ($hook != 'html') {
    return;
  }

  // Add clearfix to body to make sure all of it is content are wrapped inside it.
  $variables['classes_array'][] = 'clearfix';

  // Serialize RDF Namespaces into an RDFa 1.1 prefix attribute.
  if ($variables['rdf_namespaces']) {
    $prefixes = array();
    foreach (explode("\n  ", ltrim($variables['rdf_namespaces'])) as $namespace) {

      // Remove xlmns: and ending quote and fix prefix formatting.
      $prefixes[] = str_replace('="', ': ', substr($namespace, 6, -1));
    }
    $variables['rdf_namespaces'] = ' prefix="' . implode(' ', $prefixes) . '"';
  }
}