Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Issue #2151105 by joelpittet, longwave, c4rl, IshaDakota, pplantinga, gnuget, jeanfei, sbudker1: Convert theme_system_admin_index() to Twig
Task
Convert theme_system_admin_index() to a Twig template.
Remaining tasks
- Patch
- Patch review
- Manual testing
- Profiling
Steps to test
Navigate to /admin/index
Comment | File | Size | Author |
---|---|---|---|
#45 | 2151105-twig-system_admin_index-45-reroll.patch | 4.15 KB | joelpittet |
#42 | interdiff.txt | 1.3 KB | joelpittet |
#42 | 2151105-twig-system_admin_index-42.patch | 4.15 KB | joelpittet |
#37 | interdiff.txt | 695 bytes | joelpittet |
#36 | 2151105-twig-system_admin_index-36.patch | 4.1 KB | joelpittet |
Comments
Comment #1
joelpittetSplit from system module twig conversion meta.
Comment #2
star-szrAdding a commit message to the issue summary so the folks who already worked on #1987410: [meta] system.module - Convert theme_ functions to Twig and #1898454: system.module - Convert PHPTemplate templates to Twig (comment #41 and above aka @c4rl) get credit.
Comment #3
star-szrTagging for reroll.
Comment #4
longwavePatch applied with fuzz only, rerolled.
Comment #6
longwavePostponed on #2151107: Convert theme_system_compact_link() to Twig
Comment #7
joelpittetWhy postponing this? It uses that theme but doesn't have any conflicts between them I'm pretty sure?
Comment #8
longwaveAll the fails in #4 were related to system_compact_link, and I thought that was why - maybe not?
Comment #9
star-szrYeah I think this just got fuzzed wrong maybe?
Comment #10
longwaveSeems like somehow it got applied to the wrong part of hook_theme(), and I didn't spot that earlier. Sorry!
Comment #11
joelpittetNo worries, at least you found what it was. That is strange it would do that, I wonder if one of the hunks is so similar that when head moved they magically lined up?
Comment #12
star-szrComment #13
star-szrFor profiling let's do this at the same time as:
#2151107: Convert theme_system_compact_link() to Twig
#2151089: Convert theme_admin_block() to Twig
#2151093: Convert theme_admin_block_content() to Twig (currently RTBC)
Since it contains all of them :)
Comment #14
star-szrComment #15
star-szrUpdating testing steps in issue summary.
Comment #16
joelpittetProfile of all 3 patches and confirmed they were all on the page.
#2151107-1: Convert theme_system_compact_link() to Twig
#2151105-7: Convert theme_system_admin_index() to Twig
#2151089-11: Convert theme_admin_block() to Twig
Scenario
/admin/index
as front page.http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=53195a48b6f09&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=53195a48b6f09&...
Comment #17
joelpittetHere's the manual testing for this. The raw output from /admin/index is in the text files.
Beginning and end
Divs around the admin_blocks
Comment #18
star-szrWe'll probably want to remove this line pending #2151089: Convert theme_admin_block() to Twig.
Comment #19
longwaveThat is already removed in #2151089: Convert theme_admin_block() to Twig, this will conflict if that patch is committed first.
Comment #20
star-szr@longwave - right, good to know! Since the one here was refactored a bit I didn't catch that the first time around.
"template" should be "templates" here per Preprocess function documentation standards.
Add a trailing comma here per https://drupal.org/coding-standards#array.
Comment #21
longwaveFixed #20. Also removed one unneeded array key - 'blocks' was the only thing inside the container, so we don't need it - and two unnecessary blank lines.
Comment #22
joelpittetRTBC++
Comment #23
star-szrNice, thanks @longwave! RTBC but it'll probably make sense for #2151089: Convert theme_admin_block() to Twig to get committed first. That last change to get rid of one level in the array should actually make the template faster too, one less call to \Twig_Template::getAttribute():
Comment #24
star-szrComment #26
longwave21: 2151105-twig-system_admin_index-21.patch queued for re-testing.
Comment #27
longwaveBack to RTBC, bot fluke:
Segmentation fault
FATAL Drupal\toolbar\Tests\ToolbarAdminMenuTest: test runner returned a non-zero error code (139).
Comment #29
star-szrUploading the same (slightly different fuzz) patch as #21 so we can preserve the last testbot failure because a bunch of issues have had that same fail.
BTW, still probably makes sense to wait on #2151089: Convert theme_admin_block() to Twig before committing this one and then we can do a minor rework here. But either way works.
Comment #30
webchickI did commit that one, so marking this one needs work.
Comment #31
joelpittetRe-rolled. Removed 'show'
Comment #32
joelpittetdiffed diffs:
Comment #33
star-szrThe docblock needs some updating to better document the containers (note plural) variable and what it contains (no pun intended). Search other .html.twig templates in core with {% for %} loops to see examples of how we document these.
Comment #34
joelpittetDoc updates.
Comment #35
star-szrThanks @joelpittet that was quick!
I forgot to mention, we need to kill this @ingroup themeable. Related: #2219617: Remove @ingroup themeable from preprocess function docblocks
Comment #36
joelpittetI'm quick when I can smell RTBC:P
Comment #37
joelpittetinterdiff between #34 and #36
Comment #38
star-szrWe are definitely very very close to RTBC :)
Sorry but I think the docs here are not quite 100% after giving them another read. At minimum 'blocks' in the docblock should be 'block' but I also think 'block' within a container is a single block not a list of blocks.
Comment #39
joelpittetCan we just remove from "Each container contains: ..."
The blocks are the containers.
Comment #40
star-szrI guess what I'm zoning in on is "blocks" doesn't appear in the template at all. I'd suggest something along these lines:
Comment #41
joelpittetI see that but block is just arbitrary name given to the value of the container. Maybe it would make more sense if we call the variable "containers" to "blocks" because all other ones were we do the "Each contains:" are properties on the object in the list. In this case the object is the "block" and it has no properties.
Comment #42
joelpittetHere's what I mean, took from your #40 but tried to make it make scents, cents, and sense.
Comment #43
star-szrShould have gotten back to this sooner. New docs look good to me, thanks @joelpittet!
Patch still applies and I did another quick markup comparison and we still match up exactly.
Comment #45
joelpittetWell that shouldn't have failed it still applies with git apply and patch -p1.
Here's a re-roll just in case. Thanks for RTBC @Cottser:)
Comment #47
webchickCommitted and pushed to 8.x. Thanks!