Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
theme system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Feb 2014 at 17:17 UTC
Updated:
27 Jan 2017 at 17:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
aspilicious commentedComment #2
star-szrThanks! Tagging for test coverage.
Comment #3
star-szrComment #4
star-szrI'm working on this.
Comment #5
star-szr@aspilicious - I actually can't seem to reproduce this in a test - can you point me to or post a concrete example of this happening? Is this a module or a theme or a combination of the two?
Basically in my test I have two hook_theme() implementations pointing to theme functions, both are in modules that are installed. Theme function A is in the .module, theme function B is in a .inc file specified in 'file' in the hook_theme(). I call theme hook A then use hook_theme_suggestions_HOOK_alter() to redirect to B, but the include file gets loaded just fine.
I'm thinking we should actually just move the existing "include" code down below the suggestion hooks since I can't see where it's useful to have that until just before theme functions and preprocess functions are called anyway.
Comment #6
star-szr@aspilicious got in touch with me on IRC and provided some sample code, so I will continue to dig in here.
Comment #7
star-szrTurns out I just needed to drupalGet() twice because the theme registry is being rebuilt during the first request :)
Failing test + fix attached.
Comment #9
aspilicious commentedWorks for me :)
Comment #10
catchCode looks the same in 7.x as well, should this be tagged for backport?
Comment #11
star-szrPossibly, I can try to backport the test after commit and see what happens, at the very least we can add more test coverage to 7.x.
Comment #12
catchCommitted/pushed to 8.x, thanks!
Comment #13
star-szrHaving lack of internet problems but I am working on a test for 7.x and it fails, so as far as I can tell this wasn't a regression. Will have at least the failing test up within a few days.
Comment #14
star-szrHere's the failing test for 7.x as promised. Unassigning in case I don't have time to come back to this soon.
Comment #16
benjf commentedpatch from #1224162-1: When a preprocess function sets theme_hook_suggestions, the suggested theme hook's 'includes' are not loaded combined with the test from #14
Comment #17
star-szrThanks @benjf! Sending to the bot.
Comment #18
star-szrCool, it's green! Since there's already this code further up in theme():
The second include_once would only be used for theme suggestions in D7 so a couple things:
if $hook != $suggestion(well, something along those lines anyway).