diff options
Diffstat (limited to 'modules/field/theme/field.tpl.php')
-rw-r--r-- | modules/field/theme/field.tpl.php | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/modules/field/theme/field.tpl.php b/modules/field/theme/field.tpl.php index d58ff1637..9018f45b5 100644 --- a/modules/field/theme/field.tpl.php +++ b/modules/field/theme/field.tpl.php @@ -2,50 +2,51 @@ // $Id$ /** - * @file field-field.tpl.php + * @file field.tpl.php * Default theme implementation to display the value of a field. * * Available variables: + * - $items: An array of field values. Use render() to output them. + * - $label: The item label. + * - $label_hidden: Whether the label display is set to 'hidden'. + * - $classes: String of classes that can be used to style contextually through + * CSS. It can be manipulated through the variable $classes_array from + * preprocess functions. The default values can be one or more of the + * following: + * - field-name-[field_name]: The current field name. For example, if the + * field name is "field_description" it would result in + * "field-name-field-description". + * - field-type-[field_type]: The current field type. For example, if the + * field type is "text" it would result in "field-type-text". + * - field-label-[label_display]: The current label position. For example, if the + * label position is "above" it would result in "field-label-above". + * + * Other variables: * - $object: The object to which the field is attached. * - $field: The field array. - * - $items: An array of values for each item in the field array. * - $build_mode: Build mode, e.g. 'full', 'teaser'... - * - $page: Whether this is displayed as a page. * - $field_name: The field name. * - $field_type: The field type. * - $field_name_css: The css-compatible field name. * - $field_type_css: The css-compatible field type. - * - $label: The item label. - * - $label_display: Position of label display, inline, above, or hidden. - * - $field_empty: Whether the field has any valid value. * - $field_language: The field language. * - $field_translatable: Whether the field is translatable or not. - * - * Each $item in $items contains: - * - 'view' - the themed view for that item + * - $label_display: Position of label display, inline, above, or hidden. + * - $classes_array: Array of html class attribute values. It is flattened + * into a string within the variable $classes. * * @see template_preprocess_field() */ ?> -<?php if (!$field_empty) : ?> -<div class="field field-type-<?php print $field_type_css ?> field-<?php print $field_name_css ?>"> - <?php if ($label_display == 'above') : ?> - <div class="field-label"><?php print t($label) ?>: </div> - <?php endif;?> - <div class="field-items"> - <?php $count = 1; - foreach ($items as $delta => $item) : - if (!$item['empty']) : ?> - <div class="field-item <?php print ($count % 2 ? 'odd' : 'even') ?>"> - <?php if ($label_display == 'inline') { ?> - <div class="field-label-inline<?php print($delta ? '' : '-first')?>"> - <?php print t($label) ?>: </div> - <?php } ?> - <?php print $item['view'] ?> - </div> - <?php $count++; - endif; - endforeach;?> +<?php if ($items) : ?> + <div class="field <?php print $classes; ?> clearfix"> + <?php if (!$label_hidden) : ?> + <div class="field-label"><?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> + <?php endforeach; ?> + </div> </div> -</div> <?php endif; ?> |