Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
Twig 1.12 introduced named arguments. It's a cool feature that allows you to change the order of filter arguments or to make your code self-documenting.
Unfortunately, the theme()
function was created before that, so its first argument is just named "theme". Which is not super clear.
Proposed resolution
Rename the first parameter to be $hook
.
API changes
Before this change, the theme function could be called with:
{{ theme(
theme="item_list__node",
variables={
"items": [
"Test",
"Test2"
],
}
) }}
And after this change:
{{ theme(
hook="item_list__node",
variables={
"items": [
"Test",
"Test2"
],
}
) }}
Comment | File | Size | Author |
---|---|---|---|
#2 | 3090506-2.patch | 1.48 KB | JohnAlbin |
|
Comments
Comment #2
JohnAlbinPatch!
Comment #4
JohnAlbin