Created
December 1, 2011 16:18
-
-
Save pascalduez/1417914 to your computer and use it in GitHub Desktop.
Drupal 7 — HTML5 html.tpl.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html<?php print $html_attributes; ?>> | |
<head> | |
<?php print $head; ?> | |
<title><?php print $head_title; ?></title> | |
<?php print $styles; ?> | |
<?php print $scripts; ?> | |
</head> | |
<body<?php print $body_attributes;?>> | |
<?php print $page_top; ?> | |
<?php print $page; ?> | |
<?php print $page_bottom; ?> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_preprocess_html(). | |
*/ | |
function THEMENAME_preprocess_html(&$vars) { | |
$vars['html_attributes_array'] = array(); | |
$vars['body_attributes_array'] = array(); | |
// HTML element attributes. | |
$vars['html_attributes_array']['lang'] = $vars['language']->language; | |
$vars['html_attributes_array']['dir'] = $vars['language']->dir; | |
// Adds RDF namespace prefix bindings in the form of an RDFa 1.1 prefix | |
// attribute inside the html element. | |
if (function_exists('rdf_get_namespaces')) { | |
$vars['rdf'] = new stdClass; | |
foreach (rdf_get_namespaces() as $prefix => $uri) { | |
$vars['rdf']->prefix .= $prefix . ': ' . $uri . "\n"; | |
} | |
$vars['html_attributes_array']['prefix'] = $vars['rdf']->prefix; | |
} | |
// BODY element attributes. | |
$vars['body_attributes_array']['class'] = $vars['classes_array']; | |
$vars['body_attributes_array'] += $vars['attributes_array']; | |
$vars['attributes_array'] = ''; | |
} | |
/** | |
* Implements hook_process_html(). | |
*/ | |
function THEMENAME_process_html(&$vars) { | |
// Flatten out html_attributes and body_attributes. | |
$vars['html_attributes'] = drupal_attributes($vars['html_attributes_array']); | |
$vars['body_attributes'] = drupal_attributes($vars['body_attributes_array']); | |
} | |
/** | |
* Implements hook_html_head_alter(). | |
*/ | |
function THEMENAME_html_head_alter(&$head_elements) { | |
// Simplify the meta charset declaration. | |
$head_elements['system_meta_content_type']['#attributes'] = array( | |
'charset' => 'utf-8', | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Refined version: https://github.com/pascalduez/ineo/blob/master/primo/includes/primo.html.inc