| 1 | <?php |
| 2 | // $Id: field.tpl.php,v 1.3 2009/06/22 09:10:04 dries Exp $ |
| 3 | |
| 4 | /** |
| 5 | * @file field-field.tpl.php |
| 6 | * Default theme implementation to display the value of a field. |
| 7 | * |
| 8 | * Available variables: |
| 9 | * - $object: The object to which the field is attached. |
| 10 | * - $field: The field array. |
| 11 | * - $items: An array of values for each item in the field array. |
| 12 | * - $build_mode: Build mode, e.g. 'full', 'teaser'... |
| 13 | * - $page: Whether this is displayed as a page. |
| 14 | * - $field_name: The field name. |
| 15 | * - $field_type: The field type. |
| 16 | * - $field_name_css: The css-compatible field name. |
| 17 | * - $field_type_css: The css-compatible field type. |
| 18 | * - $label: The item label. |
| 19 | * - $label_display: Position of label display, inline, above, or hidden. |
| 20 | * - $field_empty: Whether the field has any valid value. |
| 21 | * |
| 22 | * Each $item in $items contains: |
| 23 | * - 'view' - the themed view for that item |
| 24 | * |
| 25 | * @see template_preprocess_field() |
| 26 | */ |
| 27 | ?> |
| 28 | <?php if (!$field_empty) : ?> |
| 29 | <div class="field field-type-<?php print $field_type_css ?> field-<?php print $field_name_css ?>"> |
| 30 | <?php if ($label_display == 'above') : ?> |
| 31 | <div class="field-label"><?php print t($label) ?>: </div> |
| 32 | <?php endif;?> |
| 33 | <div class="field-items"> |
| 34 | <?php $count = 1; |
| 35 | foreach ($items as $delta => $item) : |
| 36 | if (!$item['empty']) : ?> |
| 37 | <div class="field-item <?php print ($count % 2 ? 'odd' : 'even') ?>"> |
| 38 | <?php if ($label_display == 'inline') { ?> |
| 39 | <div class="field-label-inline<?php print($delta ? '' : '-first')?>"> |
| 40 | <?php print t($label) ?>: </div> |
| 41 | <?php } ?> |
| 42 | <?php print $item['view'] ?> |
| 43 | </div> |
| 44 | <?php $count++; |
| 45 | endif; |
| 46 | endforeach;?> |
| 47 | </div> |
| 48 | </div> |
| 49 | <?php endif; ?> |
| 50 |