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 #1898478 by joelpittet, Cottser, m1r1k, lokapujya, Jalandhar, organicwire, chakrapani, duellj, jessebeach, LinL, jstoller, derheap, Risse, mike.roberts, tlattimore, galooph, nadavoid, steveoliver, idflood, likin, killerpoke, EVIIILJ, vlad.dancer, podarok, mh86 | c4rl: menu.inc - Convert theme_ functions to Twig.
Task
Use Twig instead of PHPTemplate
Remaining
- Patch needs review
Theme function name/template path | Conversion status |
---|---|
theme_menu_link | Will be handled via #1777332: Replace theme_menu_link() and menu-tree.html.twig with a single Twig template |
theme_menu_local_action | converted |
theme_menu_local_task | converted |
theme_menu_local_tasks | converted |
theme_menu_tree | Will be handled via #1777332: Replace theme_menu_link() and menu-tree.html.twig with a single Twig template |
To test this code
- set the stark theme to default
- make sure a menu block is placed in a sidebar. ("Tools" or "Main menu" wil do.)
- create one node, and view it's page
- the output of theme_menu_link
, theme_menu_local_task
, theme_menu_local_tasks
, and theme_menu_tree
will be visible on this node page output.
- change your theme back to Bartik to see the output of bartik_menu_tree
- visit admin/content to see the output for theme_menu_local_action
Comment | File | Size | Author |
---|---|---|---|
#178 | interdiff.txt | 4.14 KB | joelpittet |
#178 | menu_inc_convert-1898478-178.patch | 16.18 KB | joelpittet |
#175 | interdiff-1898478-175.txt | 802 bytes | lokapujya |
#175 | 1898478-175.patch | 15.48 KB | lokapujya |
#170 | 1898478-170.patch | 15.66 KB | er.pushpinderrana |
Comments
Comment #1
c4rl CreditAttribution: c4rl commentedTagging
Comment #2
steveoliver CreditAttribution: steveoliver commentedTaking this on. Going for consolidation/use of other things like theme('item_list'), in the process.
Comment #3
steveoliver CreditAttribution: steveoliver commentedConsolidated various issues* from the Twig sandbox into this one patch.
Not consolidating or using item_list as mentioned in #2, for two reasons: 1. Straight conversion; 2. These don't always have to be formatted as lists.
TODO (once #1905584: Move base theme system templates into /core/templates is fixed):
theme_*
functions from menu.inc./core/themes/stark/templates/menu.inc/*
to/core/includes/templates/menu.inc/*
Git attribution goes to: likin, killerpoke, EVIIILJ, vlad.dancer, podarok, mh86, steveoliver
Previous sandbox issues, where these came from, in part:
#1843564: Convert theme('menu_local_tasks') to Twig
#1843560: Convert theme('menu_local_task') to Twig
#1824618: Convert theme('menu_local_action') to Twig
Comment #5
mbrett5062 CreditAttribution: mbrett5062 commentedPlease can we follow BEM principles with our class names. Just adding a class of 'primary' or 'secondary' can and will cause conflicts. Please use 'tabs--primary' and 'tabs--secondary' instead.
Here is a brief explanation of BEM for reference.
BEM is a methodology for naming
and classifying CSS selectors in a way to make them a lot more strict,
transparent and informative.
The naming convention follows this pattern:
* `.block` represents the higher level of an abstraction or component.
* `.block__element` represents a descendent of `.block` that helps form `.block` as a whole.
* `.block--modifier` represents a different state or version of `.block`.
An **analogy** of how BEM classes work might be:
Comment #6
star-szr@mbrett5062 - Thanks for the feedback!
We're working hard to get these Twig templates into core, there will definitely be more cleanup afterwards but for now we're focused on getting these templates into core before feature freeze.
There have been recent discussions and work towards CSS coding standards:
g.d.o announcement and discussion:
http://groups.drupal.org/node/277223
Draft coding standards:
http://drupal.org/node/1886770 and more specifically http://drupal.org/node/1887918 which relates to architecture.
Also #1900768: Consider BEM for CSS Coding Standards in Drupal 8.
Once the standards are worked out, the task of refactoring CSS to meet these standards would probably be best done with a meta issue and sub issues, similar to #1190252: [573] Use csslint as a weapon to beat the crappy CSS out of Drupal core. I wasn't able to find an existing meta issue tracking this.
Comment #7
mbrett5062 CreditAttribution: mbrett5062 commentedThanks for the feedback @cottser, and I agree with doing these changes in a follow up. Just glad it is noted.
Comment #7.0
star-szrAdding git attribution to issue summary
Comment #8
steveoliver CreditAttribution: steveoliver commentedJust a head's up: #916388: Convert menu links into entities is a few days from landing. We'll probably want to wait till then before looking at this again.
Comment #9
c4rl CreditAttribution: c4rl commentedBased on #1905584: Move base theme system templates into /core/templates it seems this issue would be accommodated by #1898454: system.module - Convert PHPTemplate templates to Twig, though that may result in a large patch.
Comment #10
steveoliver CreditAttribution: steveoliver commentedBased on the state of #1905584: Move base theme system templates into /core/templates which introduces support for /core/templates for these includes, this issue is active and I'm on it...
Comment #11
c4rl CreditAttribution: c4rl commentedIgnore what I said about system.module in #9, we'll proceed to convert this separately of system.module and put in /core/templates as described in #1905584: Move base theme system templates into /core/templates
Comment #12
star-szr#3: drupal-twig-menu.inc--1898478-3.patch queued for re-testing.
Comment #14
star-szrWe need to update drupal_common_theme() in theme.inc to add 'template' indexes for all these new templates.
Comment #15
star-szrWorking on a new patch right now to move this along a bit.
Comment #16
star-szrSummary of changes:
The interdiff is rolled with
git diff -C -M
to account for the file moves.All the failing tests pass locally so hopefully testbot agrees :)
Comment #17
star-szrWrong interdiff, here's the smaller one.
Comment #19
star-szrUh, oops. That doesn't belong there.
Comment #20
star-szrThis simplifies template_preprocess_menu_link() (removes drupal_render() and ternary) and updates one of the preprocess docblocks to match #1913208: [policy] Standardize template preprocess function documentation.
Comment #21
star-szrMissed "Default template". Interdiff is from #19.
Comment #22
star-szrOne more, sorry for the barrage. Just another docs tweak, interdiff is from #19 again.
Comment #22.0
star-szrMaking commit mentions from the sandbox more prominent ala http://drupal.org/node/1535868
Comment #22.1
star-szrAdd conversion summary table
Comment #23
star-szrTagging.
Comment #23.0
star-szrUpdate remaining
Comment #24
star-szrUnassigning so this can be reviewed.
Comment #25
thedavidmeister CreditAttribution: thedavidmeister commentedReview for #22:
Do we need to render these in the preprocess? they should just work as-is in the template, right? In fact, do we even need the preprocess at all here? looks like we could just use {{ primary }} and {{ secondary }} in the template.
We have a new template for menu_local_tasks but the theme function wasn't removed in the patch.
This still exists in system.theme-rtl.css
This still exists in system.theme.css
Comment #26
joelpittetCleaned up some docs and removed the preprocessing and theme for menu_local_tasks from #25
Comment #27
duellj CreditAttribution: duellj commentedbartik_menu_tree() needs to be converted here too. If the wrapper in menu_tree.html.twig is changed to use an Attribute(), then bartik can just implement a preprocess, since all it's doing is adding a class.
Comment #28
joelpittetDid #27, thanks @duellj I went with the twig file as discussed on IRC to help with #1854344: [meta] Goals for core themes: Make Stark as semantic as possible; Make Bartik a better prospective base theme
Comment #28.0
joelpittetremove sandbox link
Comment #29
c4rl CreditAttribution: c4rl commentedPer #1757550-44: [Meta] Convert core theme functions to Twig templates, retitling to indicate this issue applies to theme_ functions, which are lower in priority than PHPTemplate conversion issues.
Comment #30
joelpittetComment #31
intergalactic overlords CreditAttribution: intergalactic overlords commentedMenu's, submenu's, breadcrumbs and action links are ok, they have the same html output in both Stark and Bartik.
Tabs need a little more work.
The output for the tabs isn't the same (in both Stark and Bartik). On the active tab,
<span class="element-invisible">(active tab)</span>
should be a child of the link, but in the twig version, it is a sibling.Comment #32
Hanpersand CreditAttribution: Hanpersand commented#28: 1898478-28-twig-menu.patch queued for re-testing.
Comment #34
jstollerWorking on re-roll.
Comment #35
jstollerHere's a straight re-roll. Looking at the issue raised in #31.
Comment #36
jstollerRun through testbot.
Comment #37
jstollerI've fixed the accessibility issue raised in #31. After some discussions here at DrupalCon, we've decided to add the span tag markup directly in template_preprocess_menu_local_task(). This is not ideal. I've added a @TODO comment noting that this should be changed once the l() function is updated.
Comment #38
jstollerSorry. Uploaded the wrong patch file. The previous interdiff was correct though.
Comment #39
tlattimore CreditAttribution: tlattimore commentedMarking to needs work so we can then re-queue #38 for testing. It failed when stuff went down while the sprint was going on last Friday.
Comment #40
tlattimore CreditAttribution: tlattimore commented... and needs review.
Comment #41
tlattimore CreditAttribution: tlattimore commentedI am attaching the patch from #38 here so it can be tested by the bot. I couldn't get it to be re-queued with my attempts above.
Comment #41.0
tlattimore CreditAttribution: tlattimore commentedUpdate conversion table
Comment #42
ericaack CreditAttribution: ericaack commentedI think everything passed the manual testing steps outlined at the top of this issue, although I'd like confirmation that the output for step 4 (change your theme back to Bartik to see the output of bartik_menu_tree) is correct. The comment for what showed up in the source was:
Is there any need to use Daisy Diff on the output, or is it enough that the items listed in the testing steps were all present?
If not, and assuming the bartik_menu_tree was handled correctly, then this passes manual testing.
Comment #43
joelpittetCSS directories moved around, #41 needs re-roll.
Also, all
wrapper_attributes
should be justattributes
and can be lazy loaded for performance ala #1982024: Lazy-load Attribute objects later in the rendering process only if neededComment #44
mike.roberts CreditAttribution: mike.roberts commentedDipping my toes in the pool with a reroll. I hope I did this right.
Comment #45
star-szrReroll looks great, thanks @mike.roberts! Tagging for eventual profiling.
Comment #46
joelpittetThanks @mike.roberts! Give a go at the wrapper_attributes bit from #43
It's a the following:
wrapper_attributes
in this patch toattributes
Attribute()
instantiation around values passed toattributes
That should make things a bit quicker
Comment #47
duellj CreditAttribution: duellj commentedRerolled patch from #44 and renamed
wrapper_attributes
toattributes
Comment #49
joelpittet@duellj close, missed one;) Thank you for the patch.
I just patched that one, hopefully this will pass.
Comment #50
azinoman CreditAttribution: azinoman commentedI created both block menus and regular menus and everything looks good. Changing to reviewed and tested by community.
Comment #51
star-szrRe-tagging for profiling :) thanks for reviewing @azinoman. To be clear - when you tested did you compare the markup before and after the patch? If so we can remove the 'Needs manual testing' tag, otherwise this needs a round of manual testing.
Comment #52
star-szrNeeds another reroll.
Comment #53
joelpittetRe-rolled and remove the @see template_preprocess() note in the twig files.
Comment #54
star-szrThanks @joelpittet! Tagging again for reroll.
Comment #55
joelpittetRerolled
Comment #56
star-szrTagging for reroll. Thanks again @joelpittet :)
Comment #57
star-szrComment #58
derheap CreditAttribution: derheap commentedComment #59
derheap CreditAttribution: derheap commentedComment #61
organicwire CreditAttribution: organicwire commentedRerolled patch and removed testbot errors.
Thanks to @lduerig for the collaboration ;)
Comment #62
organicwire CreditAttribution: organicwire commentedComment #64
BarisW CreditAttribution: BarisW commentedRelated: #1777332: Replace theme_menu_link() and menu-tree.html.twig with a single Twig template
Comment #65
organicwire CreditAttribution: organicwire commented#61: 1898478-61-twig-theme-menu.patch queued for re-testing.
Comment #67
organicwire CreditAttribution: organicwire commentedTrying again to reroll.
Comment #69
organicwire CreditAttribution: organicwire commentedIt seems that $link['href'] makes problems here. In a few cases there's no 'href' key which breaks the link ("Undefined index: href") and ruins the test run. Any ideas anyone?
Comment #70
BarisW CreditAttribution: BarisW commentedGreat work so far! I've discussed the menu logics with jenlampton, mortendk and jwilson3 at the core sprint yesterday and we propose a major overhaul of the current menu setup.
The way menu's are outputted now is odd: we use theme_menu_tree for the menu's in the sidebar (with hierarchy) and we misuse theme_menu_links for the same menu's when we output them as Primary Menu or Secondary Menu. Because of this, the menu cannot have drop-downs and the checkbox in the backend (Show expanded menu) does not work at all for these two menu's.
So the main proposal here is to add a template_proprocess_menu and use that one for all menu's. Remove ALL theme_menu functions and introduce a menu.html.twig file. More info is here: #1777332: Replace theme_menu_link() and menu-tree.html.twig with a single Twig template.
This would introduces some other smaller tasks (like styling dropdowns in Bartik, but that will be taken care of later).
Comment #71
joelpittet@BarisW that sounds way better! #70
Comment #72
star-szrWe've already put a lot of work in here, so until #1777332: Replace theme_menu_link() and menu-tree.html.twig with a single Twig template is underway I suggest we continue to move forward with this issue. Troubleshooting the failing tests would be the next step, I looked at this briefly with @organicwire and @lduerig in Prague. Seemed like a tricky merge to me but if that merge can be resolved in the right way we should be able to make this green again.
Comment #73
joelpittetRe-rolled again based on #55 which was the last one to be green by testbot.
Ran the failing tests locally and they passed that failed on #67.
Would like to build out the menu_local_task link in the template because the span tag for active tab for visually impaired is hard coded in the preprocess.
Comment #73.0
joelpittetadded how to test
Comment #74
jessebeach CreditAttribution: jessebeach commentedMany contrib modules need to change the classes on the ul wrapper of menu-tree.html.twig. Does it make sense to provide these as variables so that they're more overrideable?
Comment #75
jessebeach CreditAttribution: jessebeach commentedAlso note that the current theme function does not have a clearfix class:
Comment #76
joelpittet73: 1898478-73-twig-menu.patch queued for re-testing.
Comment #77
star-szr@jessebeach - Thanks! I think that in most cases it will probably make more sense to do
<ul{{ attributes }}>…</ul>
rather than hardcoding classes into the core templates.Comment #78
hass CreditAttribution: hass commentedBut what jessebeach really needs for toolbar is the ability to change aka remove menu and clearfix classes for the toolbar menu_tree's only. Above code is in general correct as bartic overrides the classes from core.
Comment #79
mariacha1 CreditAttribution: mariacha1 commentedAfter applying patch #73 to the latest dev version of d8 my toolbar menu won't expand anymore. I tried it in both Bartik and Stark.
Comment #80
joelpittet@mariacha1 thanks for the manual test screenshots. I just gave it a go and didn't get that result (Latest FF and Chrome for mac) but I did have some odd git thing saying one file couldn't get changed so I'm reposting another re-roll just in case that helps. Just to cover all bases, could you apply this and delete /sites/default/files/php folder after applying it, just in case somethings cached in twig. It's extreme but just to make sure.
Comment #83
mariacha1 CreditAttribution: mariacha1 commentedIt's definitely still happening for me. Looking at the code produced, it looks like the ul inside div class=toolbar-menu-administration is empty. But I'm seeing other issues, like inability to write config files, on my end, so there might be something wrong with my system setup as well. If it turns out to be a false alarm, I'll report back. (I'm on Linux.)
Comment #84
jessebeach CreditAttribution: jessebeach commentedThe patch in 80 is working fine for me. No trouble with the Toolbar Menu.
mariacha1, try a clean install in a new directory. You may have residual config files causing you trouble.
Comment #85
joelpittet@mariacha1 sounds like you have your /sites/default/files/ directory not writable for the web server. For dev you can be lazy and just chmod 777 or you can add change ownership/group to the apache user.
There is also a couple twig settings in settings.php for debugging and not caching the templates. All compiled templates end up in /sites/default/files/php along with service containers and other cache files that can be deleted at will.
Comment #86
mariacha1 CreditAttribution: mariacha1 commentedThanks for all the advice everyone. I fiddled around with some things on my end and I imagine it has to do with my having the default twig settings instead of any of the custom ones.
In case anyone else has the issue, it resolved itself when I changed the default theme to a new one. I don't think it's worth worrying about.
I tested several pages with patch 80 and they all looked good to me. My only comment is that it introduces one formatting error by adding this line 1705 of core/includes/menu.inc
That
@param array variables
should be@param array $variables
.Comment #87
joelpittetNice catch, thanks for reviewing @mariacha1
Comment #88
joelpittetAdded the $ in comments as indicated in #86
Comment #89
joelpittetforgot interdiff...
Comment #90
BarisW CreditAttribution: BarisW commentedThe issue summary states that bartik_menu_tree will be handled in another issue, but the issue that is pointed to is closed and the bartik_menu_tree doesn't seem to be tackled there? Also - and probably related - why is there so much difference between the menu-tree.html.twig in the menu module compared to the same file in the bartik/templates folder?
I assume we would have the same variables available there?
Thanks for all the hard work so far. Let's get this in soon, so we can start cleaning up (and please let's stop using preprocess_links for menu's!).
Comment #91
joelpittet#2004826: bartik.theme - Convert theme_ functions to Twig this is where it was closed for this one... needs an issue summary update.
@BarisW, which differences are you refering to?
Comment #92
joelpittetHere removes the two three functions from bartik.
Comment #93
star-szrTagging for reroll.
Comment #94
idflood CreditAttribution: idflood commentedHere is a reroll.
In template_preprocess_menu_link() there was one more line in the 8.x branch:
Eventually I kept it in the reroll. This was the only notable change.
Comment #95
maggo CreditAttribution: maggo commentedComment #96
maggo CreditAttribution: maggo commentedLookin' good
Comment #97
maggo CreditAttribution: maggo commentedComment #98
star-szrThis patch still needs profiling, thanks for reviewing @maggo.
Comment #99
idflood CreditAttribution: idflood commentedThe patch wasn't applying so here is another reroll. I've also profiled this patch with 'admin/structure/menu/manage/admin' as the frontpage.
Comment #100
star-szrTagging for reroll.
Comment #101
chakrapani CreditAttribution: chakrapani commentedWorking on re-roll.
Comment #102
chakrapani CreditAttribution: chakrapani commentedHere is the re-rolled patch against the latest head.
Comment #104
jessebeach CreditAttribution: jessebeach commentedRerolled from #99.
Comment #105
star-szrComment #106
star-szrTagging for reroll.
Comment #107
chakrapani CreditAttribution: chakrapani commentedRe-rolled from #104
Comment #108
BarisW CreditAttribution: BarisW commentedPatch applies nicely with a little bit of offset.
It was RTBC before at #98, but needed profiling. That's done, and re-rolled. Code looks good to me!
Comment #109
alexpotttheme-menu-inc-1898478-107.patch no longer applies.
Comment #110
star-szrThanks @alexpott! This still applied with `patch -p1` so here's a quick reroll.
Also updating the proposed commit message because it was very out of date.
Comment #111
BarisW CreditAttribution: BarisW commentedAh sorry, I didn't know that. I used -p1 as well.
Comment #112
joelpittetNeeds a re-roll.
Comment #113
Risse CreditAttribution: Risse commentedRe-rolled.
Comment #114
Risse CreditAttribution: Risse commentedComment #115
galooph CreditAttribution: galooph commentedComment #116
galooph CreditAttribution: galooph commentedRe-rolled from #113.
Comment #117
galooph CreditAttribution: galooph commentedComment #118
jygastaud CreditAttribution: jygastaud commented116: 1898478-116.patch queued for re-testing.
Comment #120
star-szrTagging for reroll.
Comment #121
Jalandhar CreditAttribution: Jalandhar commentedUpdating the patch with reroll, Please review.
Comment #122
Jalandhar CreditAttribution: Jalandhar commentedSome files were skipped while taking the patch. Updating the patch again with all reroll changes .
Comment #124
Jalandhar CreditAttribution: Jalandhar commentedJust changing the file name of the patch. (earlier there is a space between convert and theme words)
Comment #125
Jeff Burnz CreditAttribution: Jeff Burnz commentedI assume this is meant to say menu-tree.html.twig
"each" and "individual" are pretty much the same thing, just choose one.
Again, and this time it sounds quite ambiguous as what I actually can or cannot do, e.g. from this I would expect a loop in menu-local-tasks.html.twig where I could "theme individual items".
Is this even required?
Comment #126
Jeff Burnz CreditAttribution: Jeff Burnz commentedI realise this is a strait conversion issue however it's still baffling why we have all these templates (as it was when we had all functions etc), and why we get a gnarly great string in menu-tree.html.twg and not a renderable array of items (I know why, but it's a bit mad how this all works), to my mind there should only be one template (menu.html.twig with a loop for items) and local tasks etc are suggestions or something like that. 2cents.
Comment #127
star-szrThanks @Jalandhar and @Jeff Burnz. Consolidation comes after conversion unless things are really slow - it's significantly easier to consolidate things once they are already template-ified and even if consolidation/improvement of menu items doesn't happen by 8.0 it at least means we've improved things!
I think we do need the Bartik overrides if markup is changing. I did notice that several templates are now missing newlines at the end of the file so that needs to be fixed and if it makes automated tests fail we might need to adjust those.
Comment #128
sunWeird.
This issue appears to conflict with the plan in #1777332: Replace theme_menu_link() and menu-tree.html.twig with a single Twig template ...?
Comment #129
star-szrNot sure if it's really a conflict. This issue converts, that issue consolidates. This patch is also very near RTBC and there is no patch on the other issue.
Comment #130
Jeff Burnz CreditAttribution: Jeff Burnz commentedThanks Cottser and sun, indeed that issue mentioned by sun is what I would expect to happen next, fantastic.
Comment #131
nadavoid CreditAttribution: nadavoid commentedThis patch addresses the comments in #125, including removing core/themes/bartik/templates/menu-tree--shortcut-default.html.twig because I didn't see why it was needed. There are no other matching file names in drupal core, and its markup is identical to menu-tree.html.twig. Newlines at ends of files have been added too.
Comment #132
hass CreditAttribution: hass commentedWhy not Drupal::l() on the second link?
Comment #133
tim.plunkettWe have different data, so we use different functions.
One takes title, href, options. The other takes title, route name, route params, options.
Comment #134
m1r1k CreditAttribution: m1r1k commentedLets avoid generating html in preprocess functions
Comment #136
joelpittet134: drupal8-menu_convert_theme_functions_to_twig-1898478-134.patch queued for re-testing.
Comment #138
joelpittet@m1r1k That looks like a good patch. I'm not quite sure why it fails but may have something to do with the theme=>link vs l() API differences. Of which I wish I knew by heart...
Would you mind debugging locally some of those test fails?
Comment #139
m1r1k CreditAttribution: m1r1k commentedSomething happened with local-actions content. And previous patch is also broken.
I will look at it right away.
Comment #140
m1r1k CreditAttribution: m1r1k commentedComment #142
m1r1k CreditAttribution: m1r1k commentedSilly typos
Comment #144
m1r1k CreditAttribution: m1r1k commented142: drupal8-menu_convert_theme_functions_to_twig-1898478-142.patch queued for re-testing.
Comment #146
pwolanin CreditAttribution: pwolanin commentedtheme_menu_link is being changed to use a Url object in #2256521: [META] New plan, Phase 2: Implement menu links as plugins, including static admin links and views, and custom links with menu_link_content entity, all managed via menu_ui module
Can that be supported in twig?
Comment #147
nadavoid CreditAttribution: nadavoid commented142: drupal8-menu_convert_theme_functions_to_twig-1898478-142.patch queued for re-testing.
EDIT: Queued again because running the test locally showed no errors.
Comment #148
star-szrTagging for reroll.
Unassigning since it's been a few weeks, @m1r1k if you still want to tackle this just reassign. Thanks!
@pwolanin at a glance it looks like generating the URL would happen in preprocess rather than in Twig.
Comment #149
lokapujyamerging core/themes/seven/seven.theme was a little complex.
Comment #151
lokapujyaTrying again.
Comment #152
star-szrThanks @lokapujya! I diffed the two patches, the only thing that jumped out at me as far as merge conflicts was:
This should not say "Overrides theme_menu_local_task()" because we're removing that function, just have this docblock says "Implements hook_preprocess_HOOK()…".
Comment #153
lokapujyaFixed issue mentioned in the last commented and manually tested that the each of the twig files mentioned in the issue summary are being used.
Comment #154
star-szrThank you for fixing that @lokapujya! Unfortunately this needs another reroll now, any takers?
Comment #155
LinL CreditAttribution: LinL commentedComment #156
akalata CreditAttribution: akalata commentedUpdating "To test this code" instructions since admin/content/node returns a 404.
Comment #157
akalata CreditAttribution: akalata commentedManual review of #155:
menu-link.html.twig
. Not sure how much people care about that?Switching back to Needs Work so somebody more knowledgeable can decide if the differences are negligible enough to be marked RTBC.
Comment #158
pwolanin CreditAttribution: pwolanin commentedPlease postpone any change affecting menu links until this is committed: #2256521: [META] New plan, Phase 2: Implement menu links as plugins, including static admin links and views, and custom links with menu_link_content entity, all managed via menu_ui module
Comment #159
star-szrThanks @pwolanin! I just wanted to mention that some new and useful looking templates have been introduced via #2301317: MenuLinkNG part4: Conversion, good stuff!
Comment #160
star-szrNamely menu-tree.html.twig.
Comment #161
pwolanin CreditAttribution: pwolanin commentedmight need to use the functionality from #2073811: Add a url generator twig extension
Comment #162
dawehnerI really wonder whether we could / should rather push #1777332: Replace theme_menu_link() and menu-tree.html.twig with a single Twig template given that it actually improves the experience for the themer.
Comment #163
star-szr@dawehner yes in general I would agree but that issue doesn't cover all the theme output from menu.inc I don't think. Thinking of local tasks, local actions, etc.
From the Twig conversion perspective we can at least remove anything touching menu_tree from the patch in this issue and I would be okay with leaving menu_link changes to #1777332: Replace theme_menu_link() and menu-tree.html.twig with a single Twig template. The other issue needs an issue summary update I think because it's not really doing what it says in the title/summary (unless it plans to?).
Comment #164
joelpittet@dawehner I agree I love what has started there.
@Cottser if that other one can't cover the local tasks/actions too then we can keep doing that bit here if needed?
Comment #165
star-szrYes that's what I was thinking. Divide and conquer!
Comment #166
star-szrHere's a rough reroll that also removes the conversions of menu_tree and menu_link to defer to the awesomeness of #1777332: Replace theme_menu_link() and menu-tree.html.twig with a single Twig template.
Also, a lot of people have worked on this issue. Wow.
Comment #168
joelpittet@Cottser thanks for the re-roll.
Here are a few little items that a Novice contributor can pickup, there is likely more like this, so whomever picks this up, keep a diligent eye out for coding standards or missed pieces from before the conversion. There are likely a few pieces that snuck in between the previous patch and the latest re-roll to catch up to head.
2 spaces.
extra spaces before.
Missing button class.
Comment #169
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedIncorporated #168 fixes suggested by @joelpittet, please review updated patch.
Comment #170
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedNew added files are missing in previous patch, this one is updated. Previous interdiff file is fine.
Comment #173
lokapujyawhy failing? is this now dependent on another patch?
also,
2 spaces
Comment #174
star-szrThis shouldn't depend on anything else but there may have been interdependencies on the menu_link conversion in previous patches. I didn't look too hard when I rerolled, just did it quickly.
With a bit more context this time :) otherwise it's hard to tell what you two are going on about. The contents of this array need to be indented by 2 fewer spaces.
(edited to fix typo)
Comment #175
lokapujyaComment #176
dawehnerAre we sure we don't want to use a template override for adding those classes? Note: we can call parent templates easily and just actually do the add class calls!
Comment #177
star-szrYeah those can be added much cleaner now with addClass. Those lines are very old :)
Comment #178
joelpittetRe #176 and #177 I'd love to remove those to the template but they are on the link element. And there is no NestedArray::mergeDeepArray in Twig (thankfully).
Which means this approach I took isn't viable:
That almost works just missing the
'set_active_class' => true
And second question, that preprocess is attaching modernizr... I'd love to remove that preprocess, can we safely move that somewhere else? I'm thinking seven.info.yml but need a hand on that?
I made some minor tweaks here:
Anyways, I'd rather not be too concerned about that, this patch looks RTBC. Let me know if you have any concerns with my changes. I'd like to get these 3 conversions in so we can close #1757550: [Meta] Convert core theme functions to Twig templates!
Comment #179
Fabianx CreditAttribution: Fabianx commentedIt is my honor to RTBC this! Nice work! The remainder and using more suggestions can be follow-up. But this keeps us in releasable state :).
Comment #180
alexpott180 comments and novice!
Committed cff05b2 and pushed to 8.0.x. Thanks!
Onto #1777332: Replace theme_menu_link() and menu-tree.html.twig with a single Twig template!