API page: http://api.drupal.org/api/drupal/modules%21field%21theme%21field.tpl.php/7

It says this in the template file:
THIS FILE IS NOT USED AND IS HERE AS A STARTING POINT FOR CUSTOMIZATION ONLY.

However, the extra divs included in this file were being generated in my theme (Omega) without it being present in my theme's directory. I am building a sub-theme and I did check the theme's core files.

CommentFileSizeAuthor
#2 note_at_top_of-1854074-2.patch1.13 KBjp.stacey

Comments

jhodgdon’s picture

Title: Confused about how field.tpl.php works » Note at top of field.tpl.php is not illuminating
Version: 7.17 » 7.x-dev
Category: support » bug

Sorry about your confusion! The reason is documented here:
http://api.drupal.org/api/drupal/modules!field!field.module/function/the...

Probably we should modify the "this template is not used" line at the top of field.tpl.php to say "See theme_field() for details."

I think this is probably only worth doing in 7.x, since 8.x is converting all theme functions and theme templates into Twig files, so there will not be this confusion there. At least, it will be going away soon.

jp.stacey’s picture

Title: Note at top of field.tpl.php is not illuminating » Docblock in field.tpl.php needs clarification, ref theme_field
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.13 KB

Patch attached. The documentation did include a duplicate @see theme_field() but it doesn't actually render inline, so I've replaced it with just ... theme_field() ... which, like render(), should hopefully be turned into a link.

kiwimind’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +mssprintjan17

I like how you've explained a little more why the file is not used, rather than JUST SAYING IT ISN'T. :)

Well worded, reads well, RTBC.

stefan.r’s picture

Issue tags: +Pending Drupal 7 commit
David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit

Committed to 7.x - thanks!

Fixed on commit, because it seemed a little confusing to me to say "core" rather than "Drupal core" here:

diff --git a/modules/field/theme/field.tpl.php b/modules/field/theme/field.tpl.php
index 00ca360..460fd2e 100644
--- a/modules/field/theme/field.tpl.php
+++ b/modules/field/theme/field.tpl.php
@@ -4,7 +4,7 @@
  * @file field.tpl.php
  * Default template implementation to display the value of a field.
  *
- * This file is not used by core, which uses theme functions instead for
+ * This file is not used by Drupal core, which uses theme functions instead for
  * performance reasons. The markup is the same, though, so if you want to use
  * template files rather than functions to extend field theming, copy this to
  * your custom theme. See theme_field() for a discussion of performance.
@@ -47,7 +47,7 @@
  */
 ?>
 <!--
-This file is not used by core, which uses theme functions instead.
+This file is not used by Drupal core, which uses theme functions instead.
 See http://api.drupal.org/api/function/theme_field/7 for details.
 After copying this file to your theme's folder and customizing it, remove this
 HTML comment.

  • David_Rothstein committed 5abd299 on 7.x
    Issue #1854074 by jp.stacey, jhodgdon, kiwimind: Docblock in field.tpl....

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.