- Patch #569362 by scor, effulgentsia, catch: add attributes and title_attributes() variables for tpl files so that RDFa and Microformats can be implemented.
parent
4f3e5cd940
commit
2729f1c2f0
|
|
@ -2042,6 +2042,10 @@ function template_preprocess(&$variables, $hook) {
|
||||||
// Initialize html class attribute for the current hook.
|
// Initialize html class attribute for the current hook.
|
||||||
$variables['classes_array'] = array($hook);
|
$variables['classes_array'] = array($hook);
|
||||||
|
|
||||||
|
// Initialize attributes for the top-level template entity and its title.
|
||||||
|
$variables['attributes_array'] = array();
|
||||||
|
$variables['title_attributes_array'] = array();
|
||||||
|
|
||||||
// Set default variables that depend on the database.
|
// Set default variables that depend on the database.
|
||||||
$variables['is_admin'] = FALSE;
|
$variables['is_admin'] = FALSE;
|
||||||
$variables['is_front'] = FALSE;
|
$variables['is_front'] = FALSE;
|
||||||
|
|
@ -2066,6 +2070,10 @@ function template_preprocess(&$variables, $hook) {
|
||||||
function template_process(&$variables, $hook) {
|
function template_process(&$variables, $hook) {
|
||||||
// Flatten out classes.
|
// Flatten out classes.
|
||||||
$variables['classes'] = implode(' ', $variables['classes_array']);
|
$variables['classes'] = implode(' ', $variables['classes_array']);
|
||||||
|
|
||||||
|
// Flatten out attributes and title_attributes.
|
||||||
|
$variables['attributes'] = drupal_attributes($variables['attributes_array']);
|
||||||
|
$variables['title_attributes'] = drupal_attributes($variables['title_attributes_array']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@
|
||||||
* @see template_process()
|
* @see template_process()
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<div id="block-<?php print $block->module . '-' . $block->delta; ?>" class="<?php print $classes; ?>">
|
<div id="block-<?php print $block->module . '-' . $block->delta; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>
|
||||||
<?php if ($block->subject): ?>
|
<?php if ($block->subject): ?>
|
||||||
<h2><?php print $block->subject ?></h2>
|
<h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
* @see theme_comment_wrapper()
|
* @see theme_comment_wrapper()
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<div id="comments" class="<?php print $classes; ?>">
|
<div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
|
||||||
<?php if ($node->type != 'forum'): ?>
|
<?php if ($node->type != 'forum'): ?>
|
||||||
<h2 class="comments"><?php print t('Comments'); ?></h2>
|
<h2 class="comments"><?php print t('Comments'); ?></h2>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,14 @@
|
||||||
* @see theme_comment()
|
* @see theme_comment()
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<div class="<?php print $classes; ?> clearfix">
|
<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
|
||||||
<?php print $picture ?>
|
<?php print $picture ?>
|
||||||
|
|
||||||
<?php if ($new): ?>
|
<?php if ($new): ?>
|
||||||
<span class="new"><?php print $new ?></span>
|
<span class="new"><?php print $new ?></span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<h3><?php print $title ?></h3>
|
<h3<?php print $title_attributes; ?>><?php print $title ?></h3>
|
||||||
|
|
||||||
<div class="submitted">
|
<div class="submitted">
|
||||||
<?php
|
<?php
|
||||||
|
|
|
||||||
|
|
@ -756,8 +756,24 @@ function template_preprocess_field(&$variables) {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$variables = array_merge($variables, $additions);
|
$variables = array_merge($variables, $additions);
|
||||||
|
|
||||||
|
// Initialize attributes for each item.
|
||||||
|
foreach ($variables['items'] as $delta => $item) {
|
||||||
|
$variables['item_attributes_array'][$delta] = array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Theme process function for field.tpl.php.
|
||||||
|
*
|
||||||
|
* @see field.tpl.php
|
||||||
|
*/
|
||||||
|
function template_process_field(&$variables) {
|
||||||
|
// Flatten out attributes for each item.
|
||||||
|
foreach ($variables['items'] as $delta => $item) {
|
||||||
|
$variables['item_attributes'][$delta] = drupal_attributes($variables['item_attributes_array'][$delta]);
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @} End of "defgroup field"
|
* @} End of "defgroup field"
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,13 @@
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<?php if ($items) : ?>
|
<?php if ($items) : ?>
|
||||||
<div class="field <?php print $classes; ?> clearfix">
|
<div class="field <?php print $classes; ?> clearfix"<?php print $attributes; ?>>
|
||||||
<?php if (!$label_hidden) : ?>
|
<?php if (!$label_hidden) : ?>
|
||||||
<div class="field-label"><?php print $label ?>: </div>
|
<div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>: </div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="field-items">
|
<div class="field-items">
|
||||||
<?php foreach ($items as $delta => $item) : ?>
|
<?php foreach ($items as $delta => $item) : ?>
|
||||||
<div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"><?php print render($item); ?></div>
|
<div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?></div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -70,12 +70,12 @@
|
||||||
* @see template_process()
|
* @see template_process()
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix">
|
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
|
||||||
|
|
||||||
<?php print $user_picture; ?>
|
<?php print $user_picture; ?>
|
||||||
|
|
||||||
<?php if (!$page): ?>
|
<?php if (!$page): ?>
|
||||||
<h2><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
|
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($display_submitted || !empty($content['links']['terms'])): ?>
|
<?php if ($display_submitted || !empty($content['links']['terms'])): ?>
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
// $Id$
|
// $Id$
|
||||||
?>
|
?>
|
||||||
<div id="block-<?php print $block->module . '-' . $block->delta; ?>" class="<?php print $classes; ?> clearfix">
|
<div id="block-<?php print $block->module . '-' . $block->delta; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
|
||||||
|
|
||||||
<?php if (!empty($block->subject)): ?>
|
<?php if (!empty($block->subject)): ?>
|
||||||
<h2 class="title"><?php print $block->subject ?></h2>
|
<h2 class="title"<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
|
|
||||||
<div class="content"><?php print $content ?></div>
|
<div class="content"><?php print $content ?></div>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// $Id$
|
// $Id$
|
||||||
?>
|
?>
|
||||||
<div class="<?php print $classes . ' ' . $zebra; ?>">
|
<div class="<?php print $classes . ' ' . $zebra; ?>"<?php print $attributes; ?>>
|
||||||
|
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<?php print $picture ?>
|
<?php print $picture ?>
|
||||||
|
|
||||||
<h3><?php print $title ?></h3>
|
<h3<?php print $title_attributes; ?>><?php print $title ?></h3>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<?php hide($content['links']); print render($content); ?>
|
<?php hide($content['links']); print render($content); ?>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
// $Id$
|
// $Id$
|
||||||
?>
|
?>
|
||||||
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?>">
|
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>
|
||||||
|
|
||||||
<?php print $user_picture; ?>
|
<?php print $user_picture; ?>
|
||||||
|
|
||||||
<?php if (!$page): ?>
|
<?php if (!$page): ?>
|
||||||
<h2><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
|
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($display_submitted): ?>
|
<?php if ($display_submitted): ?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue