Problem/Motivation
There are currently more templates in core than theme functions, but we still need to define 'template' in each hook_theme() definition. Templates should be the default output option.
For example, in node_theme(), the template for 'node.html.twig' is defined like this:
/**
* Implements hook_theme().
*/
function node_theme() {
return array(
'node' => array(
'render element' => 'elements',
'template' => 'node',
),
…
);
After the changes this issue will make we want it to be able to look like this and still work!
/**
* Implements hook_theme().
*/
function node_theme() {
return array(
'node' => array(
'render element' => 'elements',
),
…
);
Proposed resolution
Make 'template' the default output option for hook_theme() (the current default is 'function') and define a standard template name based on the hook name. For example 'item_list' should default to 'item-list'. The default option of 'function' is currently defined in (at least) \Drupal\Core\Theme\Registry::processExtension() and documentation would need to be updated (in at least hook_theme()) accordingly.
We'll also need to add 'function' lines to the hook_theme() definitions for all remaining theme functions in core.
Once the default is changed (with test coverage), we can get rid of all the unnecessary 'template' => 'node',
lines in core in #2246675: Remove all unnecessary 'template' lines in hook_theme() declarations.
Remaining tasks
- Write patch (novice)
- Review patch to check it fixes the issue, the change is properly documented and for coding standards. Provide test evidence (novice)
- Keep issue summary up to date (novice)
User interface changes
n/a
API changes
Minor API change to hook_theme() for better DX.
Comment | File | Size | Author |
---|---|---|---|
#182 | make_template_the-2226207-182.patch | 21.27 KB | lauriii |
#162 | 2226207-161.patch | 20.9 KB | rachel_norfolk |
#136 | 2226207-136-testing.patch | 43.6 KB | lauriii |
#136 | interdiff-2226207-testing-130-136.txt | 605 bytes | lauriii |
#112 | 2226207-112-testing.patch | 44.64 KB | star-szr |
Comments
Comment #1
lauriiiComment #2
dawehnerSo +1
Comment #3
lauriiiComment #4
euphoric_mv CreditAttribution: euphoric_mv commentedComment #5
euphoric_mv CreditAttribution: euphoric_mv commentedComment #6
star-szrTrying to make the issue summary a bit more verbose :) Thanks for jumping in on this @euphoric_mv!
Comment #8
lauriiiDo we just want to change the default template loaded to function, or do we first check if there's a function available for the specific case.
Comment #9
star-szrOops, I must have been looking at D7 when I updated the issue summary. Updated to point to the correct method.
I think we should start by changing this code:
This is setting the default to 'function' and generating a default function name. We want to do change this to do something very similar but for 'template'.
Comment #10
lauriiiSome progress, should we take this path?
Comment #11
star-szrThis definitely looks like the direction we want to go in! Sending to testbot (needs review).
I think file_exists() is a pretty expensive (slow performance) check, if we're doing this check at all it should likely be in the theme registry rebuild and not in _theme() which could easily be called hundreds of times per request. But we might be able to just let PHP handle this case :)
Comment #12
euphoric_mv CreditAttribution: euphoric_mv commented@lauriii You can assign task to you, I will unassign from myself.
Comment #13
euphoric_mv CreditAttribution: euphoric_mv commentedComment #15
jorgegc CreditAttribution: jorgegc commentedHey @Cottser,
Do you think something along the line of
would work? I want to help but I am not sure whether that is the right direction or how we would implement the file_exists within \Drupal\Core\Theme\Registry::processExtension().
Comment #16
star-szrI would lean towards no file_exists() check and just checking to see what happens when the file doesn't exist. I still think the built-in error handling of PHP and/or Twig will probably be sufficient here.
Comment #17
star-szrThe patch looks like it's failing just because we're missing some lines where we need to specify the function name, for example in aggregator_theme(), book_theme(), etc.
We should also leave all the 'template' lines alone, let's do that in a follow-up issue please :)
Comment #18
lauriiiSending to testbot
Comment #20
star-szrLooks like this needs some more love, probably more 'function' lines need to be added. Need to search all hook_theme() implementations.
I don't think the
$info['template']
line is needed based on the existing code.Comment #21
star-szrHere's an example of an error message via testbot when a template file doesn't exist (this means we need to add a 'function' line where the 'username' theme hook is defined):
Edit: And so far that's the only template-related error I'm seeing so likely just updating user_theme() will improve the testbot outcome significantly.
Comment #22
star-szrAdding the 'function' lines step to the proposed resolution. Yes, this will break conversions in #1757550: [Meta] Convert core theme functions to Twig templates but the rerolls will be easy and I think this is an important change.
Comment #23
star-szrDraft change record: https://drupal.org/node/2231673
Comment #24
star-szrSome thoughts from @sun in IRC for making verification of this patch easier so we don't break anything:
Comment #25
webchickThis sounds like a great improvement for "Themer Experience" (TX) in D8.
Comment #26
mgbellaire CreditAttribution: mgbellaire commentedHow's it going @Cottser! I'm going to give this one a try. This will be my first issue, but not my first time developing in Drupal. I know most coding standards and how to write in php, but documentation is probably the thing I need most help with.
Comment #27
star-szrGreat, thanks @mgbellaire! If you have any questions along the way post them here or you can ping me in IRC if I'm online.
Comment #28
mgbellaire CreditAttribution: mgbellaire commentedHere is @laurii's patch cleaned up into one line. I'll need a little help with how to check that it needs to be a 'function'.
Comment #29
mgbellaire CreditAttribution: mgbellaire commentedI ran grep to search through all the current "hook_theme" calls and added the proper 'function' lines myself manually. I didn't want to have to diff the patch that @lauriii created against mine. Cross your fingers, boys.
Comment #31
mgbellaire CreditAttribution: mgbellaire commented@Cottser My patch was not applied because of menu.module not existing? I'm confused. Am I not creating a patch off of the right codebase? If so, which branch should I be using?
Comment #32
mgbellaire CreditAttribution: mgbellaire commentedRe-creating patch after new pull of 8.x repository.
Comment #34
mgbellaire CreditAttribution: mgbellaire commented32: template_as_default-function_lines_added-2226207-32-8x.patch queued for re-testing.
Comment #37
mgbellaire CreditAttribution: mgbellaire commentedMore function lines.
Comment #39
joelpittet@mgbellaire could you provide an interdiff so we can see what you have changed between the patches you are posting? See instructions https://drupal.org/documentation/git/interdiff or my workflow: http://pittet.ca/drupal/sprint/patch.
If you have
ack
orag
you can use a command like this to help find things:ack -Q -C 2 "'render element' => "
ack -Q -C 2 "'variables' => "
Comment #40
star-szr@mgbellaire Thanks! I wasn't able to respond to you in IRC the other day (traveling) but it looks like we lost the changes to theme.inc. You can compare or diff your patch against the one in 18 to see what I mean.
Comment #41
mgbellaire CreditAttribution: mgbellaire commented@Cottser: Yes, it looks like we did. I don't know how my grep missed that... I'll have to re-check the command that I use. I'll be looking into ack more! :)
I'm changing that now. Will Create new patch soon.
Comment #42
mgbellaire CreditAttribution: mgbellaire commentedAlso, shame on me for not looking thoroughly enough into @lauriii's patch to see my obvious mistake. mgbellaire--
Comment #43
mgbellaire CreditAttribution: mgbellaire commentedChanged the theme.inc file, and it doesn't look like their are any more changes that I'm aware of.
Comment #44
mgbellaire CreditAttribution: mgbellaire commentedComment #46
mgbellaire CreditAttribution: mgbellaire commentedsystem.api.php didn't have any templates or functions.
Comment #48
star-szr@mgbellaire thanks! I'd really encourage you again to include interdiffs. The changes to system.api.php aren't necessary here since the body of
hook_theme()
is just an example. I don't think we should updatehook_theme()
in this issue, but rather create a separate issue to replace 'forum_display' with the 'forums' declaration fromforum_theme()
.Looking at the test failures it looks like we're missing a 'function' line for
more_link
andviews_theme()
will need some special treatment because there is a foreach in there.Comment #49
mgbellaire CreditAttribution: mgbellaire commentedThis patch is merely to take away the system.api.php changes and add a 'function' => 'theme_more_link' line to the 'more_link' declaration.
Comment #50
mgbellaire CreditAttribution: mgbellaire commented@Cottser: It looks like views_theme() takes each plugin and creates a template where there isn't a function. Doesn't that cover what we need it to do?
Comment #51
star-szr@mgbellaire - I think in views_theme() we want to tweak the logic to add 'function' lines to the Views plugins that have theme functions, almost the programmatic version of what we've been doing with the other patches to date on this issue.
Setting to needs review to try and get the last patch tested and see where we're at.
Comment #53
mgbellaire CreditAttribution: mgbellaire commentedTweaked theme_views() to programmatically add 'function' line when it finds a theme function.
Comment #55
mgbellaire CreditAttribution: mgbellaire commented@Cottser: Only 2 fails now! I don't know why the test is failing. It's saying something about theme suggestions.
Comment #56
star-szrTesting theme APIs gets confusing with all the
theme_theme
action ;)'function' should be 'theme_theme_suggestions_test_include' here.
Comment #57
mgbellaire CreditAttribution: mgbellaire commentedChanged the line that @Cottser mentioned. Will the test pass now? :D Finger crossed!
Comment #58
mgbellaire CreditAttribution: mgbellaire commentedComment #59
star-szrGreen! I'm going to work on that verification script and I realized tonight that the script could be useful for contrib module/theme developers as well so all the more reason to make it happen.
In the meantime, this needs some test coverage.
Comment #60
mgbellaire CreditAttribution: mgbellaire commentedJust found a line in views.module that didn't comply to Drupal coding standards.
Comment #61
markhalliwellComment #62
markhalliwellComment #64
star-szrRerolled.
Comment #65
markhalliwell@Cottser, here is the added exceptions we talked about recently. This throws a fatal when attempting to build the registry and the theme function doesn't actually exist.
In fact, I was able to find a few errors that were easily fixed by including the path and file the theme hooks were located in.
I also fixed a related sub-issue where we were namespacing our include paths for Twig? This actually prevented proper autodiscovery of templates, which was evident by the hack I removed in Registry.php:
Comment #67
markhalliwellYeah... that didn't go over so well :)
I've already identified the issue and will be working on this later tonight.
Comment #68
markhalliwellAlright, this should clear it up.
Comment #70
markhalliwellWell, even though there's no actual "test" per se, we do know that any test will not pass if it defines a "function" to use but then not actually implement that function (which is far better than a script):
Theme hook "aggregator_page_rss" refers to a theme function callback that does not exist: "theme_aggregator_page_rss"
So, this patch took out that theme hook, which is a relic and should have been removed in #1963544: Convert aggregator/rss to views.
I also talked with @joelpittet about the namespaces in Twig and fixed it so that we're adding paths to the
__main__
namespace (for auto-discovery) as well as specific namespaces like:@node/node.html.twig
.This should be green now :)
Comment #71
markhalliwellGave it a once over myself, found a couple issues:
Typo. It actually loads the last template found (which is why module paths are added before theme paths).
Typo. Don't need to include
theme_
.Comment #72
markhalliwellDespite that it's green and after really thinking about how autoloading works, I realized that it should be a separate issue. Didn't mean to scope creep.
After talking with @joelpittet, I'm also going to make the removal of explicit
'template'
definitions in hook_theme() a separate issue.Comment #73
markhalliwellAlso, after talking with @jessebeach, I've removed the (seemingly unused)
toolbar_item
theme hook.Comment #74
markhalliwellCreated follow-up.
Comment #75
star-szrFollow-up already existed (check child issues ;)) updating issue summary to point to it.
Comment #76
markhalliwellSorry, just overlooked it...
Comment #77
star-szrI want to review this again soon. This does need a reroll after some Twig conversions got in though, any takers? If so, feel free to reassign while you're working on it.
Comment #78
LinL CreditAttribution: LinL commentedRerolled.
Comment #80
LinL CreditAttribution: LinL commentedSorry, missed one, here it is again.
Comment #81
LinL CreditAttribution: LinL commentedComment #82
star-szrThanks @LinL, here's some feedback on the reroll:
Can't do both 'template' and 'function' in hook_theme(). These were recently converted to Twig so we should keep the 'template' line that's in HEAD and not add a 'function' line.
There may be others like this in the patch.
Comment #84
LinL CreditAttribution: LinL commentedThanks @Cottser. Wasn't sure about that, it did look a bit odd. So, keep 'template', get rid of 'function'. On to it :)
Comment #85
LinL CreditAttribution: LinL commentedHere's another try...
Comment #86
star-szrThis is looking great overall, I have a couple questions that are probably more for @Mark Carver so I'm assigning to him.
I guess we are not handling the case where neither 'function' or 'template' is specified in hook_theme() and no template exists, because it seems like that will only surface when trying to actually use the theme hook/output. Is there any way we can handle that without doing a file_exists()? Off the top of my head I can't think of a way but maybe I'm missing how we are catching these cases now.
Making this an elseif seems questionable to me because it's modifying a different array key than the code above, what's the reasoning?
Comment #87
star-szrSmall conflict in simpletest.module after #1898452: simpletest.module - Convert theme_simpletest_result_summary functions to Twig got in, here's a reroll that just removes this now unnecessary hunk:
Comment #88
LinL CreditAttribution: LinL commentedAnd again now that #1987418: user.module - Convert theme_ functions to Twig has been committed.
Removes this:
Comment #89
markhalliwell#86.1:
We don't need to check if a template exists because Twig will throw a fatal error saying that the file does not exist.
edit (didn't answer the other question): No, we need
function_exists()
. This really isn't too much of a performance impact and is cached once the registry has been built.#86.2:
This is just some cleanup to only include
views.theme.inc
for core view template (because the preprocessing doesn't live in an already loaded file). Otherwise it sets the path and file appropriately based on the plugin.Comment #90
star-szrThanks @Mark Carver!
So this patch looks good code-wise, but I don't think it's ready to be committed yet. I tried experimentally removing the
'template' => 'node',
line from node_theme() and cleared cache to rebuild the theme registry. Things mostly seemed to work okay, however Views UI (and possibly other things) complain. Here is a screenshot of editing the frontpage view with one sample node added:Removing all the 'template' lines (regular expression I used to bulk search & replace added to the issue summary of #2246675: Remove all unnecessary 'template' lines in hook_theme() declarations) resulted in a WSOD. So this needs some more work before it can be committed.
Comment #91
star-szrAnd if it helps this is what I saw after resetting everything to HEAD and clearing caches:
Comment #92
m1r1k CreditAttribution: m1r1k commentedI will jump on it during #drupalaton.
Seems we need to reroll it because functions theme_menu_tree(), theme_forum_form(), theme_update_manager_update_form(), theme_update_report(), theme_update_version(), theme_update_status_label() are gone after related Twig convert issues.
Comment #93
star-szrYup that sounds right, thanks a bunch @m1r1k!
Comment #94
m1r1k CreditAttribution: m1r1k commentedFunctions were removed:
theme_menu_tree(), // #2301317: MenuLinkNG part4: Conversion
theme_forum_form(), // #1987400: forum.module - Convert theme_ functions to Twig
theme_update_manager_update_form(), // #1898466: update.module - Convert theme_ functions to Twig
theme_update_report(), // #1898466: update.module - Convert theme_ functions to Twig
theme_update_version(), // #1898466: update.module - Convert theme_ functions to Twig
theme_update_status_label().// #1898466: update.module - Convert theme_ functions to Twig
Interdiff is absent because previous patch could not be applied.
Comment #95
m1r1k CreditAttribution: m1r1k commentedComment #97
m1r1k CreditAttribution: m1r1k commentedFails occurred because I remove template names from update_theme(). @dawehner helped to find a problem.
Comment #98
dawehnerShould all of those call the path/file bit?
Not 100% sure whether this is the proper exception though, tbh.
Would it make sense to add a followup to put this into a element type?
this is really an improvement!
Comment #99
markhalliwell#98.1: Yes, very likely. I probably overlooked those when adding in the first one. Don't know why they live in that file in the first place though, very odd.
#98.2: Not entirely sure. I remember asking @tim.plunkett in IRC one day about this, I believe we came to this conclusion. Not my area of expertise, so if it needs to change to some other exception class, fine by me. Just need to throw some sort of exception ;)
#98.3: No, I think this was just a remnant from the toolbar twig conversion. I remember talking to @jessebeach about this at DC Austin briefly.
toolbar_item
has no template nor a theme function, it's just a dead theme hook and doesn't do anything as far as I can tell.#98.4: Cool :) I was hoping someone could review this in better detail though. When I originally did this, it was out of sheer necessity. I'm a little concerned with @Cottser's discovery in #90, but haven't had a chance to look into it too deeply.
Comment #100
dawehnerJust read the official documentation again:
Exception thrown if a callback refers to an undefined function or if some arguments are missing.
This is exactly what we want.
m1r1k and I had a small pair-debugging session to figure that out. The interdiff is the fix for that particular problem.
Comment #101
m1r1k CreditAttribution: m1r1k commentedWell now it works only because DrupalKernel directly includes menu.inc:
require_once DRUPAL_ROOT . '/' . Settings::get('menu_inc', 'core/includes/menu.inc');
But I think we have to put it into the themes definition as well at least to provide this dependency information in the proper place. Because once someone will remove those lines from DrupalKernel.
Also I'll toggle issue status to resend it to testing.
Comment #102
m1r1k CreditAttribution: m1r1k commentedComment #104
m1r1k CreditAttribution: m1r1k commentedWell if theme uses twig template but needs file with prerocess to be included we have to include it via 'includes' key otherwise twig template will not be found.
Comment #105
m1r1k CreditAttribution: m1r1k commentedComment #106
LinL CreditAttribution: LinL commentedPatch no longer applies after changes to image.module and views_ui.module.
Tagging for reroll.
Comment #107
m1r1k CreditAttribution: m1r1k commentedRerolled
Comment #112
star-szrPutting this patch up to see what else might break (this includes all the 'template' line removals – but I'm not proposing we include them in this issue) but overall this seems much much closer to working well. Thank you @m1r1k and @dawehner!
With the attached patch applied I see this on the default homepage, which if I had to guess looks like something is not going through template_preprocess() that was before:
Comment #114
lauriiiThe problem is that there's some functions that doesn't exist in certain situations. E.g
theme_authorize_message()
andtheme_authozie_report()
are located intheme.maintenance.inc
which is included only on maintenance mode I guess. I uploaded patch to test if thats true. I also had to reroll @Cottsers patch so there's no interdiff. :/Comment #115
lauriiiTestbot gogo!
Comment #116
lauriiiFixed some typos and added
views.module
changes to the actual patch.Comment #121
lauriiiFound reason why preprocesses are not running..
Comment #125
lauriiiThe failing tests are because there is some templates named with underscore. So far templates I found using underscore are:
config_translation_manage_form_element.html.twig
,twig_theme_test.php_variables.html.twig
andtwig_namespace_test.html.twig
Comment #126
lauriiiComment #129
lauriiiFixed small typo which caused failing tests.
Comment #131
lauriiiThere was some unnecessary code removed in the previous patch. In this comment I have applied patch with all the templates removed from the code and functions (2226207-130-testing.patch). Then there's patch that has only functions added (2226207-130.patch) and there's interdiff between these two (interdiff-testing-2226207-130.txt).
Comment #134
joelpittetSmall note:
These are both spelled wrong.
Comment #135
star-szrThanks a ton for working on this @lauriii!
Super minor but these should be left as is if possible (not removed) in the "non-testing" patch.
Comment #136
lauriiiNow it should be right. I was too tired to do something like that.. :D
Comment #138
lauriiiThere was unnecessary theme function called from the
views_ui_theme()
which most likely caused breaking testsComment #139
lauriiiComment #140
star-szr@lauriii, you rock! A couple nice green patches. So I was about to write a change record, turns out I already did that: https://www.drupal.org/node/2231673.
I was going to update it to add the note about the exception that would be thrown if your theme function doesn't exist (BadFunctionCallException, can be seen in #107 patch). But it seems like we lost that somewhere in the past 24 hours :) Can we add that back please?
Comment #141
lauriiiNice!
I removed the exception since there is cases where we have functions that are not being included. I mentioned that in my comment #114. Another option would be to add all dependencies to theme_hook implementations using function. Which one would we prefer?
Comment #142
star-szrI see what you mean. Need to think about that some more, both ways have their pros and cons. Right now I'm leaning a bit towards declaring the dependencies because that way if other modules want to use those theme functions then they don't need to worry about including the (I'm assuming .inc) files.
In the meantime can we update the docs for hook_theme() to reflect this change?
Comment #143
lauriiiI started implementing the documentation change to hook_theme
Comment #144
star-szrThanks @lauriii! Confusing interdiff but I managed to scroll down :) great start on the docs update. Here's some feedback:
Can we use an example with an underscore please? To show that for example the 'search_result' theme hook gets converted to a 'search-result' template name I think is pretty important. Plus I think node is actually a bad example to use here. If we can come up with a non-foo_bar example to use here that isn't used in core I think that might be even better, that would apply to the below as well.
To me this still sounds like function is auto registered (at least for themes). "will be assigned". I think it should be clearer that whether it's a theme or not registering the theme hook, the function name needs to be manually specified.
Here's a bit of an attempt:
function: If the theme implementation is not a template but a theme function, you must specify the function name. For example, a theme hook of 'search_result' would by convention use a theme function of 'theme_search_result'. If you are building a theme called 'chameleon' that registers a new 'search_result' hook and theme function, you would usually use 'chameleon_search_result' as the theme function name.
Regarding the exception and dependencies, I'm still thinking manually specifying the dependencies in hook_theme() is a more solid solution, and keeping the exception.
Comment #145
rteijeiro CreditAttribution: rteijeiro commentedI'll fix lauriii's mess :P
Comment #146
rteijeiro CreditAttribution: rteijeiro commentedI applied @Cottser suggestions in #144. Also added exception back and included file dependency.
Let's see what does testbot say (https://www.drupal.org/node/2203045)
Comment #148
rteijeiro CreditAttribution: rteijeiro commentedSorry, I forgot the path U_U!
Comment #149
star-szrHere's the testing patch with all the possible 'template' lines removed from #136 with the relevant interdiffs since then applied. Just want to make sure that one is still green with the recent changes.
This is looking very promising though, thanks @rteijeiro! The only thing is I think there may be a few too many commas in the revised docs :)
I think here we can remove all commas but this one on the second line:
"'search_result' hook and theme function, then you"
Comment #150
star-szrHere's the interdiff that's more than 0 bytes. Forgot
--staged
:)Comment #151
lauriiiRerolled the patch and fixed @rteijeiros mess with the comma :P
Comment #153
lauriiiOk for some reason I messed up the patch with 'theme_toolbar'..
Comment #154
star-szrNeeds a reroll now that theme_aggregator_page_opml() is gone.
#2154781: Convert aggregator/sources and aggregator/opml to views
Comment #155
lauriiiComment #156
star-szrThanks! Just updated the change record a bit to talk about the BadFunctionCallException and reworked the first paragraph so it makes more sense.
Comment #157
skwashd CreditAttribution: skwashd commentedAfter talking to @rteijeiro and @lauriii the language in the docs could be cleaner. Here is the update patch and interdiff.
Comment #158
star-szrThanks for taking a look @skwashd! Looking better, the docs for 'template' look good now.
This part is not correct though, under 'function':
That's the key change here. If neither 'template' nor 'function' is specified, a default template name will be assumed/inserted/whatever.
Comment #159
rteijeiro CreditAttribution: rteijeiro commentedTagging as documentation and novice and trying to find somebody to fix it.
P.S. What's wrong with my spanglish? :P
Comment #160
star-szrA possible way to solve this would be to use stronger language for 'function' like "…you must specify the function name…".
Comment #161
rachel_norfolkComment #162
rachel_norfolkI've changed the language used on the function documentation as per #158. I think it describes how default templates are now assumed when neither a function nor a template is given.
Comment #163
mikl CreditAttribution: mikl commentedThis looks good, and works even better, great work.
Comment #164
lauriiiThe documentation still needs more work.
Comment #165
lauriiiComment #166
davidhernandezI'm currently reviewing the docs lines and change record.
Comment #167
davidhernandezShouldn't the template line here be removed?
In the attached patch I just modified some comments.
Comment #168
star-szrThanks @davidhernandez!
We're removing all the soon-to-be-unnecessary 'template' lines in #2246675: Remove all unnecessary 'template' lines in hook_theme() declarations to keep this patch smaller and easier to review.
Most of the changes from the previous patch look great. The troublesome 'function' section has a repeated sentence now and IMO is not clear enough about the array-PI here. I don't think we should be repeating the stuff from underneath 'template' to tell people how to use 'function'.
I can try to put this into words and update the patch if someone else wants to review. @joelpittet? :D
Comment #169
davidhernandezI'm fine chopping out that 'for example' line. Wasn't too keen on it.
Comment #170
markhalliwellmakes no sense here IMO, these are supposed to be function names only. They have nothing to do with templates.
This entire block really should probably just say something like:
"If neither 'template' nor 'function' is specified, the theme hook will behave as if a default template was defined. See above for more details."
Comment #171
rachel_norfolkComment #172
rachel_norfolkIt was me that repeated slightly too much of the template text. I have repaired that.
Also, I looked at the text at #170 but felt that keeping it consistent with the text in the template field description made for easier reading. Hope that's okay.
Comment #173
markhalliwellAwesome. Yeah, I wasn't married to exactly what I wrote, was just saying it should be something to that effect ;)
Setting back to RTBC now that the documentation has been iterated on.
Comment #174
star-szrThat works for me. Thanks everyone!
Comment #175
star-szrOh, the patch grew a lot.
Comment #176
lauriiiComment #177
davidhernandezI was literally just submitting that and got the "user changed the values" error. Do we have to yell jinx? :)
Comment #179
lauriiiVery minor reroll
Comment #180
star-szr+1, the docblock to twig_render_template was updated in #1332068: ENGINE_render_template() and ENGINE_extension() are undocumented so hunk removed here. Thanks @lauriii!
Comment #182
lauriiiOne more time..
Comment #183
star-szr+1, looks good. Small conflict with #2201789: Don't print "_theme()" in twig_debug output. Thanks again :)
Comment #184
alexpottNice work everyone. Looking forward to the follow up removing all the template info from hook_theme().
Committed d3f105e and pushed to 8.0.x. Thanks!