Issue #1077602 by Jacine, skottler, dcmouyard, jasonrsavino, matglas86, cosmicdreams, scor: Convert node.tpl.php to HTML5.

8.0.x
catch 2011-10-29 20:32:13 +09:00
parent a942081654
commit 3312541e08
2 changed files with 38 additions and 19 deletions

View File

@ -1352,6 +1352,9 @@ function node_build_content($node, $view_mode = 'full', $langcode = NULL) {
$node = node_invoke($node, 'view', $view_mode, $langcode);
}
// Make the view mode available in the node object.
$node->view_mode = $view_mode;
// Build fields content.
// In case of a multiple view, node_view_multiple() already ran the
// 'prepare_view' step. An internal flag prevents the operation from running
@ -1423,6 +1426,20 @@ function node_is_page($node) {
return (!empty($page_node) ? $page_node->nid == $node->nid : FALSE);
}
/**
* Process variables for page.tpl.php
*
* @see page.tpl.php
*/
function node_preprocess_page(&$variables) {
// In order to have properly sectioned HTML5 markup for nodes, the title is
// always printed inside node.tpl.php. This code prevents it from printing in
// page.tpl.php as well.
if (!empty($variables['node']->view_mode) && $variables['node']->view_mode == 'full' && node_is_page($variables['node'])) {
$variables['title'] = '';
}
}
/**
* Process variables for node.tpl.php
*

View File

@ -77,34 +77,36 @@
* @see template_preprocess_node()
* @see template_process()
*/
?>
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
<?php print $user_picture; ?>
// Hide the comments and links so they can be rendered apart from $content
// afterwards.
hide($content['comments']);
hide($content['links']);
?>
<article id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>
<?php print render($title_prefix); ?>
<?php if (!$page): ?>
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
<?php if ($display_submitted || $user_picture || $title): ?>
<header>
<?php print $user_picture; ?>
<?php if ($page): ?>
<h1<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h1>
<?php else: ?>
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
<?php endif; ?>
<p class="submitted"><?php print $submitted; ?></p>
</header>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($display_submitted): ?>
<div class="submitted">
<?php print $submitted; ?>
</div>
<?php endif; ?>
<div class="content"<?php print $content_attributes; ?>>
<?php
// We hide the comments and links now so that we can render them later.
hide($content['comments']);
hide($content['links']);
print render($content);
?>
<?php print render($content); ?>
</div>
<?php print render($content['links']); ?>
<?php if ($links = render($content['links'])): ?>
<nav><?php print $links; ?></nav>
<?php endif; ?>
<?php print render($content['comments']); ?>
</div>
</article>