I'm pretty sure that template is intended for theming drupal 7s built in image fields.

Comments

ankur’s picture

Title: field--image.tpl.php is used for every field on a content type called "Image" » prevent ambiguity in names of template files for fields
Version: 7.10 » 8.x-dev

Usually, when you create a field named "image" through the field_ui module in core, your field would end up being named "field_image". So your template file should be named field--field_image.tpl.php if you want the template to apply to all instances of this field.

Needless to say, however, it is actually possible to have a field whose machine readable name is image rather than field_image while also having a content-type with a machine-readable name of image. In this case, having a template file named field--image.tpl.php would indeed be picked up for all fields being rendered for an image node.

Since changing this would amount to an API change, this should probably be an 8.x issue. However, the task of fixing this specific issue might be moot depending on the resolutions taken for #1499460: [meta] New theme system and for #1382350: [discussion] Theme/render system problems

If not moot, my suggestion would be using a different naming convention where the field name, entity-type, and bundle have fixed locations in the name structure of a template file.

For example, if we use a convention like field-[FIELD_NAME]-[ENTITY_TYPE]-[BUNDLE_NAME].tpl.php, then we would have the following template names for the accompanying situations:

field--field_x--node--y.tpl.php: template file for all fields named "field_x" in the "y" bundle of the "node" entity-type.

field--field_x--node.tpl.php: template file for all fields named "field_x" in all entities of entity-type "node".

field----node.tpl.php: all fields that are in all entities of entity-type "node"

field--field_x.tpl.php: all fields named "field_x" regardless of entity and bundle.

field------y.tpl.php: all fields in all bundles named "y" in all entity-types (though I couldn't imagine a use case where we'd have bundles of the same name under different entity-types).

star-szr’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)

I think we can close this as a duplicate of #2229355: Field template suggestions are colliding.