diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-09-11 06:48:03 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-09-11 06:48:03 +0000 |
commit | 2729f1c2f0ae6aa790edf1a8be70a74fae04934c (patch) | |
tree | 160fa3de22ec22c8b63d4c09e41769cd8902b98e /modules/field | |
parent | 4f3e5cd94085d9a83aa9e52c95bf0fd7aedfb753 (diff) | |
download | brdo-2729f1c2f0ae6aa790edf1a8be70a74fae04934c.tar.gz brdo-2729f1c2f0ae6aa790edf1a8be70a74fae04934c.tar.bz2 |
- Patch #569362 by scor, effulgentsia, catch: add attributes and title_attributes() variables for tpl files so that RDFa and Microformats can be implemented.
Diffstat (limited to 'modules/field')
-rw-r--r-- | modules/field/field.module | 16 | ||||
-rw-r--r-- | modules/field/theme/field.tpl.php | 6 |
2 files changed, 19 insertions, 3 deletions
diff --git a/modules/field/field.module b/modules/field/field.module index 487ea3595..75dc3d431 100644 --- a/modules/field/field.module +++ b/modules/field/field.module @@ -756,8 +756,24 @@ function template_preprocess_field(&$variables) { ), ); $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" */ diff --git a/modules/field/theme/field.tpl.php b/modules/field/theme/field.tpl.php index 9018f45b5..312c4b844 100644 --- a/modules/field/theme/field.tpl.php +++ b/modules/field/theme/field.tpl.php @@ -39,13 +39,13 @@ */ ?> <?php if ($items) : ?> - <div class="field <?php print $classes; ?> clearfix"> + <div class="field <?php print $classes; ?> clearfix"<?php print $attributes; ?>> <?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; ?> <div class="field-items"> <?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; ?> </div> </div> |