|
1 <?php |
|
2 |
|
3 /** |
|
4 * @file field.tpl.php |
|
5 * Default template implementation to display the value of a field. |
|
6 * |
|
7 * This file is not used by Drupal core, which uses theme functions instead for |
|
8 * performance reasons. The markup is the same, though, so if you want to use |
|
9 * template files rather than functions to extend field theming, copy this to |
|
10 * your custom theme. See theme_field() for a discussion of performance. |
|
11 * |
|
12 * Available variables: |
|
13 * - $items: An array of field values. Use render() to output them. |
|
14 * - $label: The item label. |
|
15 * - $label_hidden: Whether the label display is set to 'hidden'. |
|
16 * - $classes: String of classes that can be used to style contextually through |
|
17 * CSS. It can be manipulated through the variable $classes_array from |
|
18 * preprocess functions. The default values can be one or more of the |
|
19 * following: |
|
20 * - field: The current template type, i.e., "theming hook". |
|
21 * - field-name-[field_name]: The current field name. For example, if the |
|
22 * field name is "field_description" it would result in |
|
23 * "field-name-field-description". |
|
24 * - field-type-[field_type]: The current field type. For example, if the |
|
25 * field type is "text" it would result in "field-type-text". |
|
26 * - field-label-[label_display]: The current label position. For example, if |
|
27 * the label position is "above" it would result in "field-label-above". |
|
28 * |
|
29 * Other variables: |
|
30 * - $element['#object']: The entity to which the field is attached. |
|
31 * - $element['#view_mode']: View mode, e.g. 'full', 'teaser'... |
|
32 * - $element['#field_name']: The field name. |
|
33 * - $element['#field_type']: The field type. |
|
34 * - $element['#field_language']: The field language. |
|
35 * - $element['#field_translatable']: Whether the field is translatable or not. |
|
36 * - $element['#label_display']: Position of label display, inline, above, or |
|
37 * hidden. |
|
38 * - $field_name_css: The css-compatible field name. |
|
39 * - $field_type_css: The css-compatible field type. |
|
40 * - $classes_array: Array of html class attribute values. It is flattened |
|
41 * into a string within the variable $classes. |
|
42 * |
|
43 * @see template_preprocess_field() |
|
44 * @see theme_field() |
|
45 * |
|
46 * @ingroup themeable |
|
47 */ |
|
48 ?> |
|
49 <!-- |
|
50 This file is not used by Drupal core, which uses theme functions instead. |
|
51 See http://api.drupal.org/api/function/theme_field/7 for details. |
|
52 After copying this file to your theme's folder and customizing it, remove this |
|
53 HTML comment. |
|
54 --> |
|
55 <div class="<?php print $classes; ?>"<?php print $attributes; ?>> |
|
56 <?php if (!$label_hidden): ?> |
|
57 <div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>: </div> |
|
58 <?php endif; ?> |
|
59 <div class="field-items"<?php print $content_attributes; ?>> |
|
60 <?php foreach ($items as $delta => $item): ?> |
|
61 <div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?></div> |
|
62 <?php endforeach; ?> |
|
63 </div> |
|
64 </div> |