Closed (won't fix)
Project:
Drupal core
Version:
11.x-dev
Component:
theme system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Jun 2014 at 22:20 UTC
Updated:
8 Dec 2025 at 23:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
schnitzel commentedComment #3
schnitzel commentedComment #4
andypostComment #5
joelpittetBumping as it's a feature request.
Comment #9
ksenzeeLooks good to me, and we do need it.
Comment #10
lauriiiIt looks like this makes the pre-existing bug where template suggestions collide even worse. Therefore I think we have to wait till #1367354: The list of theme hook suggestions for "field" is incorrectly ordered and has namespacing collisions gets fixed.
Comment #13
joelpittetSince the issue this was postponed on was fixed in another manor I'll reopen this for review.
Comment #14
safallia joseph commentedComment #15
safallia joseph commentedHi,
Rerolled the patch in #3 so as to sanitize the view mode name and create the template suggestion. Please review.
Thanks!
Comment #16
safallia joseph commentedComment #17
safallia joseph commentedComment #18
kbeck303 commentedI have tested the patch in comment #17 on drupal version 8.5.1 and the field theme suggestions by view mode are displaying as excepted.
field-featured-image = field name
exhibition = content type
teaser = view mode
Comment #19
markhalliwellComment #21
weseze commentedAttached is a patch that works against 8.6.
I could not find any tests in core that test for field template suggestions. Where should I start looking to add tests?
Comment #30
nikhil_110 commentedTre to #21 Cs issue fix for Drupal 10.x
Comment #31
ashutosh ahirwal commentedProviding Patch.
Comment #32
smustgrave commentedPatch #30 appears to have a small out of scope change.
Moving back to NW as the tests are still needed.
Comment #36
prudloff commentedI added a test.
Comment #37
smustgrave commentedIssue summary appears to be incomplete, missing solution section
Comment #38
prudloff commentedI added the proposed solution.
Comment #39
smustgrave commentedThanks! Changes appear good.
Comment #40
nod_We're trying to move away from template suggestions so not sure it makes sense to add more for everyone to use, I mean the issue is more than 10 years old no sure it's worth adding something we're trying to move away from.
Comment #41
pdureau commentedI totally agree. With SDC and other additions, we are heading to a future where template suggestions will not be necessary anymore.
Moreover, the proposed change (6 lines in
hook_theme_suggestions_field()) is a manageable task for projects who can set precisely the template suggestions they expects instead of enabling all of them in oursystemmodule.Comment #42
pdureau commented