Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Now when I started testing specific preprocess functions in more complicated use cases I figured out that we forgot to add support for second level of preprocess functions (hook__foo__bar) without first level appearing at all (hook__foo).
Proposed resolution
Make it support the second level.
Remaining tasks
-
User interface changes
-
API changes
-
Data model changes
-
Comment | File | Size | Author |
---|---|---|---|
#12 | specific_preprocess-2556785-9-test-only.patch | 2.19 KB | lauriii |
#9 | interdiff.txt | 619 bytes | Antti J. Salminen |
#9 | specific_preprocess-2556785-9.patch | 3.2 KB | Antti J. Salminen |
#8 | specific_preprocess-2556785-8.patch | 2.6 KB | Antti J. Salminen |
#8 | specific_preprocess-2556785-test-8.patch | 1.59 KB | Antti J. Salminen |
Comments
Comment #2
lauriiiComment #3
davidhernandezI don't quite understand. Are you saying you want to preprocess something specific when the actual theme implementation doesn't exist? Can you provide a non-generic example, like you were doing this with nodes or fields?
Comment #4
lauriiiI'm saying that
hook_preprocess_field__node__article
doesn't work withouthook_preprocess_field__node
being defined because of the logic insideRegistry::postProcessExtension()
Comment #5
RainbowArrayI didn't even know that was a thing.
Comment #6
lauriiiSee comments #349 and #353 on #2214241: Field default markup - removing the divitis
Comment #7
Antti J. Salminen CreditAttribution: Antti J. Salminen as a volunteer commentedWorking on this.
Comment #8
Antti J. Salminen CreditAttribution: Antti J. Salminen as a volunteer commentedA test and the proposed fix.
Comment #9
Antti J. Salminen CreditAttribution: Antti J. Salminen as a volunteer commentedAlso removing workaround that exists because of this issue, should pass without it now...
Comment #11
markhalliwellYes, second... (or more) levels of template/preprocessing suggestions is a "thing". I would imagine that most people don't know or use this in core/contrib because it's not really that necessary (yet). However, in any given client site/theme where it is rather complex, this pattern will undoubtedly be used and taken advantage of.
Comment #12
lauriiiUploading a test only patch from the previous patch
Comment #13
lauriiiUps there was a test only patch but I missed it from the first comment... Sorry for the noise.
Comment #15
Antti J. Salminen CreditAttribution: Antti J. Salminen as a volunteer commentedThe status was only reset because of the second test only patch finishing. Setting back to RTBC.
Comment #16
alexpottIt's good to have this fixed. This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 5a79883 and pushed to 8.0.x. Thanks!
@lauriii if you upload a test-only.patch after the rtbc patch - upload the rtbc patch again too so automated rtbc testing does not come around and set this to needs work.