Problem/Motivation
template_preprocess()
signature was changed in #1972514: Impossible to set attributes for all entities. That issue missed changing a single line.
Proposed resolution
Apply patch at #30 to remedy this oversight. Add test to detect changes like this in the future (test only patch is in #9).
Remaining tasks
None
User interface changes
None
API changes
None
Related Issues
Original report by Cottser
theme() sometimes runs template_preprocess(), and the function signature for template_preprocess() was changed in #1972514: Impossible to set attributes for all entities.
One line patch coming which updates the call to template_preprocess() to avoid warnings like:
Warning: Missing argument 3 for template_preprocess(), called in /drupal/core/includes/theme.inc on line 1130 and defined in template_preprocess() (line 2474 of core/includes/theme.inc).
Comment | File | Size | Author |
---|---|---|---|
#30 | drupal-warning-missing-argument-2030457-30.patch | 5.69 KB | markhalliwell |
#30 | interdiff.txt | 655 bytes | markhalliwell |
#25 | interdiff.txt | 3.43 KB | markhalliwell |
#23 | drupal-warning-missing-argument-2030457-19.patch | 5.66 KB | markhalliwell |
#23 | interdiff.txt | 1.13 KB | markhalliwell |
Comments
Comment #1
star-szrComment #3
star-szr#1: 2030457-1.patch queued for re-testing.
Comment #4
effulgentsia CreditAttribution: effulgentsia commentedPatch looks great. But this means we're missing test coverage for that if statement, since if we had it, HEAD would be failing tests now. Any chance of adding a test?
Comment #5
effulgentsia CreditAttribution: effulgentsia commentedChanging issue attributes for #4, but if there's a reason why adding a test for this is problematic, please say so.
Comment #5.0
markhalliwellUpdated issue summary.
Comment #6
markhalliwellI ran into this as well. I'm sorry, but this really should just be RTBC.
This was probably introduced with a lot of the Twig changes.These types of "typos" are honestly just bound to happen sometimes. The signature hasn't changed in like... forever, so I can see how you might propose this should require testing. However, seeing as this is the only place these are actually invoked... seems a little like overkill to me.It's really just an annoying bug of a coding oversight. Reading the comment above it suggests this really just has to do with themes provide a
twigtemplate for a theme hook that is only implemented as a function. This will and probably should go away once #1757550: [Meta] Convert core theme functions to Twig templates has been finalized anyhow.Regardless if they finish that or not, and D8 can still implement theme hooks via functions, this just needs to get fixed. I'll update the issue summary.
Comment #6.0
markhalliwellUpdated issue summary.
Comment #7
markhalliwellSearched the commit history of theme.inc. Not related to Twig, just an oversight.
Comment #8
markhalliwellI'll work getting a test in.
Comment #9
markhalliwellAlrighty, on my local I was able to get it to fail without the patch and pass with the patch. Go bot go :)
Comment #9.0
markhalliwellUpdated issue summary.
Comment #9.1
markhalliwellUpdated issue summary.
Comment #10
markhalliwellUpdated issue summary.
Comment #11
star-szrThank you very much @Mark Carver! Test is looking very good, just found some tiny nitpicks:
Instead of escaping the single quotes, surround the assertion message in double quotes.
For a summary line this is slightly too long, should fit in 80 characters. Additional description can be added in a paragraph below if needed, but this can probably just be shortened. See http://drupal.org/node/1354#functions.
I would love for this test output to end in a period, just to make it consistent with other theme test output.
Please return a render array from the page callback :) See #2006152: [meta] Don't call theme() directly anywhere outside drupal_render().
Comment #12
markhalliwellYeah, apparently PHPStorm keeps resetting my project settings so my drupal code sniffer was not running. I cleaned up some of the verbiage to better reflect what is happening. Good catch on the the theme() to render array. Old habits die slowly lol
Comment #12.0
markhalliwellUpdated issue summary.
Comment #13
star-szrLooking better :)
Both of these are now too long to be summary lines. Summary lines can't wrap - per https://drupal.org/node/1354#drupal "All summaries (first lines of docblocks) must be under 80 characters…"
You don't need to drupal_render() here, you can just return a render array from the page callback. return array('#theme' => …);
Comment #14
markhalliwellAh. Didn't read that part, sorry. Here's the right patch.
Comment #15
star-szrI have no more nits to pick, this looks good to me. Thanks @Mark Carver!
Comment #16
catchThe test menu callback should use the new routing system instead - otherwise we'll have to convert that later. Otherwise agreed it looks good.
Comment #17
markhalliwell@catch: I'm confused, should I convert the entire theme_test menu to the new routing system? The only reason I didn't was because we don't change stuff that doesn't pertain to the issue at hand.
Comment #18
catchIt's fine to add a new item as a route, and leave the rest as hook_menu().
Comment #19
markhalliwellThis test requires the custom theme to be used on this page callback, which currently isn't doable via the routing system. See #1954892: Replace 'theme callback' and hook_custom_theme() with a clean theme negotiation system.
Comment #20
markhalliwellNevermind, dawehner helped me figure out the weird combination of the two.... seems sketchy at best.
Comment #21
markhalliwellOk, here's it using the new routing.yml. Let me know what you think.
Comment #23
markhalliwellDrush IQ fail, doesn't add unstaged files. New patch.
Comment #25
markhalliwellCorrect interdiff.txt
Comment #26
markhalliwell#23: drupal-warning-missing-argument-2030457-19.patch queued for re-testing.
Comment #27
star-szrRe-titling.
Comment #28
star-szr(double post)
Comment #28.0
star-szrUpdated issue summary.
Comment #29
star-szrThis docblock should just use {@inheritdoc}. Other than that, RTBC :)
Ref. https://drupal.org/node/1354#inheritdoc
Comment #30
markhalliwellPatch submitted by the Drush iq-submit command.
Comment #31
star-szrThanks, looks good :)
Comment #31.0
star-szrUpdated issue summary.
Comment #32
alexpottCommitted 1398ddf and pushed to 8.x. Thanks!
Comment #33.0
(not verified) CreditAttribution: commentedUpdated issue summary.