Original report by Ryan Weal
Language (D6/D7 menu link language -> D8 menu link). In cases where one unified menu was used for the entire site menu links have a translation setting that is optional. If it is not set, it will display for all languages. If it is set, it will only display when the user is viewing the site in that language. Menu links in D6 and D7 are NOT aware of their siblings (ie, other translations). They only know what node they are connected to and nothing more.
| Comment | File | Size | Author |
|---|---|---|---|
| #43 | migrate_d7_menu_links-2669978-43.patch | 29.31 KB | arturs.v |
| #43 | interdiff.txt | 625 bytes | arturs.v |
| #38 | migrate_d7_menu_links-2669978-38.patch | 29.31 KB | jofitz |
| #38 | interdiff.txt | 3.28 KB | jofitz |
Comments
Comment #2
quietone commentedComment #3
quietone commentedComment #4
jofitzI have written a D7 menu links plugin based on (and extending) the D6 version.
Rather than converting all links to simply
'internal:/' . $pathit also handle<front>and all node menu links (because the menu_ui module filters by uri starting with'entity:node/'when displaying Menu Settings on the node edit page).Comment #6
jofitzChecked in D8.1.1.
Separate D6/7 migration templates. Add D7 menu migration template mapping "main-menu" to "menu". Remove redundant source plugin.
Comment #8
jofitzCorrected test fails.
Comment #10
jofitzCorrections for test failures - in tests, replaced old migration executions (menu, menu_links) with new (d7_menu, d7_menu_links).
Comment #11
vasi commentedLooks really good.
Is this necessary for D7? I'm not even sure what it's for in D6.
Please document why this is needed for nodes, and not other types.
Comment #12
jofitzComment #13
vasi commentedSorry, I meant "please document in the *code* why this is needed for nodes and not other types". Your explanation makes sense, but it's not at all obvious from reading the code. I don't want someone to accidentally remove it later without realizing its importance.
Comment #14
jofitzExtended comment, as requested.
Comment #16
jofitzRe-roll.
Comment #17
phenaproximaI think this patch is going to need very extensive test coverage. Menu migration is quite tricky on a good day, and we need to be certain these migrations can handle anything that might be thrown at them.
If we're untagging this migration as being Drupal 7-applicable, we need to rename menu_links.yml to d6_menu_links so it's not ambiguous.
This is no longer needed.
This seems complex. Can't we use a regex?
entity:menuneeds to be single-quoted.Again, I think we'll have to separate these migrations into d6_menu and d7_menu if they are not going to be generic.
Comment #18
jofitzentity:menubecause none of the other 80 instances ofplugin: entity:*are single-quoted.Will add tests in a later patch.
Comment #20
jofitzEnsure the
MenuLinkTests are calling the new d6/d7 migrations.Comment #22
jofitzEnsure that the d6 MigrateMenuTest calls the d6_menu migration.
(and improve the readability of the D7 MigrateMenuLinkTest).
Comment #24
jofitzIncrease the expected number of menu_link_content entities (having added one to the test fixture).
Comment #25
jofitzAdd D7 MigrateMenuTest.
Comment #26
jofitzAdd tests for all possibilities for d7_internal_uri process plugin.
Comment #28
jofitzCorrected expected test entity counts.
Comment #29
jofitz@phenaproxima you recommended very extensive testing. Do you think this requires any further tests adding to it? If so, can you suggest please. Thanks.
Comment #30
imiksu#28 needs re-roll.
Comment #31
imiksuComment #32
jofitzRe-roll
Comment #33
phenaproximaLet's add a skip_on_empty between migration and static_map in case the lookup fails.
And let's do the same here.
I'd rather use == here, since any empty value would indicate an internal URI.
We could do a more robust job of detecting entity URIs here (anything matching \w+/\d+ could potentially be one), but I'm not sure if we should do that in this patch or pursue it in a follow-up issue.
Let's use assertCount() here.
The amount of testing we have will probably suffice for now.
Comment #34
jofitzChanges in response to @phenaproxima's code review:
skip_on_emptyto both menu_links migrations.===with==.assertCount().I recommend we create a follow-up issue to do a more robust job of detecting entity URIs - it could take a while and this ticket has taken a long time to get even this far.
Comment #36
jofitzCorrected entity counts that caused test failure.
Comment #37
phenaproximaUgh, I should have mentioned this in my previous review (sorry!) -- but we should probably have a dedicated unit test of InternalUri as well.
Comment #38
jofitzAdded a unit test of InternalUri.
Comment #39
phenaproximaNeeds to be {@inheritdoc}, but can be fixed on commit.
RTBC assuming tests pass.
Comment #40
phenaproximaHere's a tip: when RTBCing a patch, remember to RTBC the patch. #PhenIsAnIdiot
Comment #41
jofitzThat'll teach me for trusting my IDE to auto-complete documentation correctly. PhpStorm--
Comment #42
imiksuDue to #39 comment, tagged for novice task. We'll work on that task today.
Comment #43
arturs.v commentedFixed the inheritdoc. Iterdiff included.
Comment #44
phenaproximaThis is the nit of nits, but it needs be
{@inheritdoc}, all lowercase. Probably fixable on commit, though.Comment #45
arturs.v commentedThe patch file actually contains a correct value (lowercase). Sorry about the faulty interdiff.
A.
Comment #48
catchThis looks great. I think it's going to be hard to improve on this without real world testing, so committed/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!
Comment #49
tstoecklerThe weak checking for entity URIs in this issue is potentially very problematic, see #2648996: Optimize menu link migration for more information. We should open a follow-up to align the two URI plugins for D6 and D7.
Comment #50
catchDoh I meant to ask for that follow-up. It seems better to have entity links going to non entities, than non-entity links going to entities, but we should definitely make that more robust. Opened here: #2822881: Improve Entity URI checking in menu link migration.
Comment #51
tstoecklerAwesome, thanks!
Comment #52
gábor hojtsyWhile the issue summary talks about language, the actual issue is migrating menu link and has no language behavior at all. So removing the tags / parent. The issue summary is totally unrelated to what the patch does, but I don't think its valuable to update now.