field.tpl.php

field.tpl.php Default template implementation to display the value of a field.

This file is not used and is here as a starting point for customization only.

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: The current template type, i.e., "theming hook".
    • 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:

  • $element['#object']: The entity to which the field is attached.
  • $element['#view_mode']: View mode, e.g. 'full', 'teaser'...
  • $element['#field_name']: The field name.
  • $element['#field_type']: The field type.
  • $element['#field_language']: The field language.
  • $element['#field_translatable']: Whether the field is translatable or not.
  • $element['#label_display']: Position of label display, inline, above, or hidden.
  • $field_name_css: The css-compatible field name.
  • $field_type_css: The css-compatible field type.
  • $classes_array: Array of html class attribute values. It is flattened into a string within the variable $classes.

See also

theme_field()

template_preprocess_field()

80 string references to the theme hook from field.tpl.php

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

comment_admin_overview in drupal/modules/comment/comment.admin.inc
Form builder for the comment overview administration form.
DatabaseCondition::compile in drupal/includes/database/query.inc
Implements QueryConditionInterface::compile().
DatabaseCondition::condition in drupal/includes/database/query.inc
Implements QueryConditionInterface::condition().
DatabaseCondition::where in drupal/includes/database/query.inc
Implements QueryConditionInterface::where().
DatabaseCondition::__clone in drupal/includes/database/query.inc
PHP magic __clone() method.

... See full list

File

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

Related topics