This one is slightly complex, but I'll try to explain simply...
Suppose one has a theme function/file with a preprocessor in an include file, the include file will be added by Drupal to the theme registry, and when calling the theme function the preprocessor will be called also. If however, a suggestion is used, with the theme function as a base, then the include will not be included, even though the preprocessor functions for the base function will be called by Drupal (though they aren't around to be called, so silently fail.)
Marking as needs review to see if the testbot picks up the failing test (which tests this issue.)
Comments
Comment #1
steven jones commentedActually that test was broken.
Comment #2
steven jones commentedAnd a possible fix?
Comment #3
dvessel commentedThis should be done while building the registry. Including it from theme() is not a good idea. We should work towards simplifying theme().
Comment #4
steven jones commentedEither way,
themewill need to include the extra files right?Can you justify your statement:
Please?
Comment #5
dvessel commentedThat wasn't helpful was it? I meant to say that the include should be happening from the existing include statement. We shouldn't be adding another.
The best place to process it is here I think:
http://api.drupal.org/api/drupal/includes--theme.inc/function/drupal_fin...
http://api.drupal.org/api/drupal/includes--theme.inc/function/drupal_fin...
Comment #6
dvessel commentedComment #7
dvessel commentedI'm completely behind on writing functional tests so if you could re-roll that with the test, I think this will be ready to go in.
Comment #8
steven jones commentedNeeds work then...
Comment #9
steven jones commentedAdded the test from comment 1.
Changing to Drupal 8.
Comment #10
steven jones commented#1: drupal-theme-preprocess-include.patch queued for re-testing.
I want to make sure that the test fails in D8
Comment #12
dvessel commentedIt failed. What's next?
Comment #13
steven jones commentedWell, the test correctly shows that your 'fix' to the issue doesn't work, so I'd guess you'd want to fix that...
Comment #14
dvessel commentedIt was originally patched for 7.
It failed.
From the test results:
From a bad test.
Comment #15
steven jones commented?
The test seems to have correctly detected that the fix did not fix the issue, hence the fail? Has the theme system changed massively already? Maybe you could modify the test to make it work with your code, as you must have a test for your fix of some kind that passes?
Comment #16
steven jones commented#2: drupal-theme-preprocess-include-fix.patch queued for re-testing.
Comment #17
dvessel commentedOkay, looks like it didn't fix it. That section in theme() where it switches hooks by looking for the base is flawed. I'd hate to pile more workarounds because of it but there isn't much choice until it's fixed.
Comment #18
kscheirerComment #19
lauriiiIn Drupal 8 \Drupal\system\Tests\Theme\ThemeSuggestionsAlterTest::testSuggestionsAlterInclude() proves this is working. Moving back to Drupal 7.
Comment #20
damienmckennaBack to "needs work" as there's an existing patch that just needs to be improved upon.