Problem/Motivation

The d7 menu language settings need to be migrated.

Proposed resolution

Use the taxonomy vocabulary language settings migration as a guide for the settings and do the same for menu.

To be sure the new, post revert, patch is working I made some screenshots of 'admin/config/regional/content-language'

Before

After

Remaining tasks

CommentFileSizeAuthor
#80 3110669-80.patch77.29 KBquietone
#80 diff-66-80.txt893 bytesquietone
#73 3110669-73-protected-static-modules.patch686 bytestr
#66 3110669-66.patch77.34 KBquietone
#66 interdiff-61-66.txt3.63 KBquietone
#61 3110669-61-9.1.patch79.09 KBquietone
#61 3110669-61-8.9.patch79.04 KBquietone
#59 3110669-59-9.1.patch79.09 KBquietone
#59 interdiff-57-59-9.1.txt1.15 KBquietone
#57 3110669-57-9.1.patch79.08 KBquietone
#57 3110669-57-9.0.patch79.04 KBquietone
#57 3110669-57-8.9.patch79.04 KBquietone
#57 diff-43-57-9.1.txt26.34 KBquietone
#57 diff-43-57-9.0.txt25.96 KBquietone
#57 diff-43-57-8.9.txt25.96 KBquietone
#52 3110669-52-revert-9.1.patch84.87 KBquietone
#52 diff-49-52.txt26 KBquietone
#50 diff-31-49-revert.txt478 bytesquietone
#49 3110669-49-revert-9.1.patch84.87 KBquietone
#49 interdiff-47-49.txt522 bytesquietone
#47 3110669-47-revert-9.1.patch84.63 KBquietone
#45 After.png27.74 KBquietone
#45 Before.png4 KBquietone
#44 3110669-43.patch79.04 KBquietone
#44 interdiff-42-43.patch1.38 KBquietone
#42 3110669-42.patch79.06 KBquietone
#42 diff-20-42.txt35.39 KBquietone
#32 diff-20-31-revert.txt100.74 KBquietone
#31 3110669-31-revert.patch84.83 KBquietone
#31 interdiff-29-31.txt4.33 KBquietone
#29 3110669-29-revert.patch80.03 KBquietone
#20 interdiff_17-20.txt616 bytesravi.shankar
#20 3110669-20.patch84.78 KBravi.shankar
#17 3110669-17.patch84.74 KBquietone
#17 interdiff-13-17.txt2.58 KBquietone
#13 3110669-13.patch84.83 KBquietone
#13 interdiff-12-13.txt28.61 KBquietone
#12 3110669-12.patch127.5 KBquietone
#12 interdiff-10-12.txt608 bytesquietone
#10 3110669-10.patch127.25 KBquietone
#10 interdiff-8-10.txt562 bytesquietone
#8 3110669-8.patch126.96 KBquietone
#8 interdiff-6-8.txt832 bytesquietone
#6 3110669-6.patch126.35 KBquietone
#2 3110669-2.patch268.85 KBquietone

Comments

quietone created an issue. See original summary.

quietone’s picture

Status: Active » Needs review
StatusFileSize
new268.85 KB

And a patch to start this off.

Status: Needs review » Needs work

The last submitted patch, 2: 3110669-2.patch, failed testing. View results

gábor hojtsy’s picture

Yay thanks for doing this one. Do we really need this much test data updates? :)

quietone’s picture

@Gábor Hojtsy, No, we don't. I still need to trim the dump file.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new126.35 KB

This removes unneeded changes to the test fixture and a test for the source plugin. The interdiff failed and a diff was large and well, just noise, so I didn't add it.

Status: Needs review » Needs work

The last submitted patch, 6: 3110669-6.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new832 bytes
new126.96 KB

Let's fix that test and correct the migration state file.

Status: Needs review » Needs work

The last submitted patch, 8: 3110669-8.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new562 bytes
new127.25 KB

And fixing the entity count

Status: Needs review » Needs work

The last submitted patch, 10: 3110669-10.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new608 bytes
new127.5 KB

And another menu was added.

quietone’s picture

StatusFileSize
new28.61 KB
new84.83 KB

Let's see if changes to the fixture can be reduced further.

quietone’s picture

That's all that I see to remove from the fixture to reduce the size of this patch.

Ready for review.

quietone’s picture

Issue tags: +migrate-d7-d8, +i18n-migrate

Adding tags

gábor hojtsy’s picture

Status: Needs review » Needs work

Generally looks great, thanks! I noticed some leftover things from the base term migration code :) These are all minor.

  1. +++ b/core/modules/language/migrations/d7_language_content_menu_settings.yml
    @@ -0,0 +1,54 @@
    +  # State is the value in the i18n_mode column of taxonomy_vocabulary table
    

    Hm, its not the taxonomy_vocabulary table though? menu_custom right?

  2. +++ b/core/modules/language/migrations/state/language.migrate_drupal.yml
    @@ -8,6 +8,9 @@ finished:
    +    i18n_manu:
    +      - language
    

    manu?

  3. +++ b/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentMenuSettingsTest.php
    @@ -0,0 +1,77 @@
    +    // No multilingual options for terms, i18n_mode = 0.
    

    not terms

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new2.58 KB
new84.74 KB

Fixes for the items in #16.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Looks great now, thanks!

quietone’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Novice
+++ b/core/modules/language/src/Plugin/migrate/source/d7/LanguageContentSettingsMenu.php
@@ -0,0 +1,50 @@
+ *   source_module = "i18n_taxonomy"

This should be i18n_menu.

This is simple text change, tagging novice.

ravi.shankar’s picture

Status: Needs work » Needs review
StatusFileSize
new84.78 KB
new616 bytes

Here I have made changes as suggested in comment #19.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Re-rtbcing from #18. The requested changes have landed.

  • Gábor Hojtsy committed d011423 on 9.0.x
    Issue #3110669 by quietone, ravi.shankar: Migrate d7 menu language...

  • Gábor Hojtsy committed afce6ac on 8.9.x
    Issue #3110669 by quietone, ravi.shankar: Migrate d7 menu language...
gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Novice

Superb, thanks! Next up is #3112249: Migrate d7 menu translation.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

quietone’s picture

Status: Closed (fixed) » Needs review

While working on the other i18n menu issues I can to realize that this patch isn't right. This should be more like the d6 version and simply enable the language content settings for the 'menu_link_content' type. As it is it enables the settings for the menu bundles, but they don't show up in the language settings ui at admin/config/regional/content-language.

I think the migration should be:

id: d7_language_content_menu_settings
label: Drupal 7 language content menu settings
migration_tags:
  - Drupal 7
  - Configuration
source:
  plugin: extension
  name: i18n_menu
  constants:
    target_type: 'menu_link_content'
    langcode: 'site_default'
    enabled: true
    hide: 0
process:
  target_entity_type_id: 'constants/target_type'
  # menu_link_content has a bundle key but no bundle support so use the entity
  # type as the bundle.
  target_bundle: 'constants/target_type'
  default_langcode: 'constants/langcode'
  # Drupal 7 menus are translated when the i18n_menu module is enabled.
  language_alterable: status
  'third_party_settings/content_translation/enabled': 'constants/enabled'
  'third_party_settings/content_translation/bundle_settings/untranslatable_fields_hide': 'constants/hide'
destination:
  plugin: entity:language_content_settings

Opinions?

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

catch’s picture

Status: Needs review » Needs work

Just tried to revert this, but the revert is no longer clean against 9.1.x, so this could use a revert patch.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new80.03 KB

Never made a revert patch before. Let's see how this goes.

Status: Needs review » Needs work

The last submitted patch, 29: 3110669-29-revert.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new4.33 KB
new84.83 KB

Humbug, I somehow missed adding the tests to the patch.

quietone’s picture

StatusFileSize
new100.74 KB

I've checked the revert patch by doing lsdiff on the patches in #20 and #31, both change the same files. And I made a diff as well, it may be of use to a reviewer.

gábor hojtsy’s picture

Title: Migrate d7 menu language content settings » ROLLBACK Migrate d7 menu language content settings

Spot-checked various points in this patch and it does seem to be rolling back the same things it added indeed.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Meant to RTBC it, sorry.

xjm’s picture

Title: ROLLBACK Migrate d7 menu language content settings » REVERT Migrate d7 menu language content settings

"Rollback" also means a migrate feature, so retitling for clarity.

  • xjm committed 7890008 on 8.9.x
    Revert "Issue #3110669 by quietone, ravi.shankar: Migrate d7 menu...

  • xjm committed 5ee8882 on 9.0.x
    Revert Issue #3110669 by quietone, Gábor Hojtsy: Migrate d7 menu...
xjm’s picture

Title: REVERT Migrate d7 menu language content settings » Migrate d7 menu language content settings
Status: Reviewed & tested by the community » Needs work

I reverted the original 8.9.x commit, then committed #31 to 9.0.x and cherry-picked it forward to 9.1.x.

I guess this is then NW for #26?

abhijeet.kumar2107’s picture

Assigned: Unassigned » abhijeet.kumar2107
abhijeet.kumar2107’s picture

Assigned: abhijeet.kumar2107 » Unassigned
abhijeet.kumar2107’s picture

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new35.39 KB
new79.06 KB

Start over from the patch based on the patch in #20.

quietone’s picture

Status: Needs review » Needs work

This needs a 9.0 and 9.1 patch.

I've got before and after screenshot to upload later today.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new1.38 KB
new79.04 KB

Removed unnecessary quotes from the migration yml.

This patch is for 8.9 and 9.0. I can't make one for 9.1.x because this previous version has not been reverted from 9.1.x, even though xjm said it was done in #38

quietone’s picture

Issue summary: View changes
StatusFileSize
new4 KB
new27.74 KB
xjm’s picture

It seems #31 didn't apply to 9.1.x and somehow I didn't notice that the cherry-pick failed. Sorry! So we need a different revert patch for that?

quietone’s picture

StatusFileSize
new84.63 KB

OK. Here is a revert patch for 9.1.x. I haven't run any tests locally.

Status: Needs review » Needs work

The last submitted patch, 47: 3110669-47-revert-9.1.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new522 bytes
new84.87 KB

Missed a change.

quietone’s picture

StatusFileSize
new478 bytes

I thought it might be useful to have a diff between the revert patch in #31, applied to 8.9 and 9.0, and the patch for 9.1.x in #49. There is one difference, which is that [#3024682 ] was committed on 18 May.

The next thing here is to get the revert patch in #49 to RTBC, and after that make a new patch for 9.1.x.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, looks good to me.

quietone’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new26 KB
new84.87 KB

'Twas in need of another reroll.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Re-roll is green.

  • catch committed 6e78799 on 9.1.x
    Issue #3110669 by quietone, ravi.shankar, Gábor Hojtsy, xjm: Migrate d7...
catch’s picture

Version: 9.1.x-dev » 8.9.x-dev
Status: Reviewed & tested by the community » Needs work

Committed/pushed to 9.1.x, thanks!

I think that means we go back to 'needs work' here.

catch’s picture

Component: migration system » menu_link_content.module
quietone’s picture

Component: menu_link_content.module » migration system
Status: Needs work » Needs review
StatusFileSize
new25.96 KB
new25.96 KB
new26.34 KB
new79.04 KB
new79.04 KB
new79.08 KB

Now for the corrected patch. The latest correct patch, post revert is in 43 which is in #44.

Moving back to migration system because the the migrate maintainers use that component to find the issues to review. If there is a desire to move issues to modules the idea can be brought to a migrate meeting.

Status: Needs review » Needs work

The last submitted patch, 57: 3110669-57-9.1.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new1.15 KB
new79.09 KB

Fixing the 9.1.x version of the patch

quietone’s picture

There are now patches for 8.9, 9.0 (both in#57 and 9.1 in #59. There is nothing in the patch that should cause a failure on PostgresSQL but I tested it anyway. Or should I say eventually, I kept clicking the wrong test and version (plus the mouse battery was low and it has a mind of its own) but got there eventually.

quietone’s picture

StatusFileSize
new79.04 KB
new79.09 KB

Needed a reroll. and now a separate patch for 9.1.x.

jibran’s picture

Just on suggestion.

+++ b/core/modules/language/migrations/d7_language_content_menu_settings.yml
@@ -0,0 +1,25 @@
+  target_entity_type_id: constants/target_type
...
+  target_bundle: constants/target_type
+  default_langcode: constants/langcode
...
+  third_party_settings/content_translation/enabled: constants/enabled
+  third_party_settings/content_translation/bundle_settings/untranslatable_fields_hide: constants/hide

Why are not using default value plugin here? tracking down constants is difficult to debug imo.

quietone’s picture

For consistently with d6_language_content_menu_settings.yml and other d*_language_content_*_settings.yml. Also, these are small yml files and the constants are defined in the 'source:' a few lines above so shouldn't be hard to track down.

quietone’s picture

Add d6 menu link migration as a related issue.

daffie’s picture

Status: Needs review » Needs work

The patch looks good to me. Only I do have some questions:

  1. +++ b/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentMenuSettingsTest.php
    @@ -0,0 +1,59 @@
    +    $target_entity = 'menu_link_content';
    ...
    +    $this->assertSame($target_entity, $config->getTargetEntityTypeId());
    

    Can we just remove the variable $target_entity.

  2. +++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php
    @@ -20982,31 +20995,43 @@
    +  'i18n_mode' => '5',
    

    Why do you set the value to '5' in this case, where all other values are set to '0'? When I do a code base search, I find possible values of 0, 1, 2 and 4, but not 5.

  3. +++ b/core/modules/language/migrations/d7_language_content_menu_settings.yml
    @@ -0,0 +1,25 @@
    +    target_type: menu_link_content
    +    langcode: site_default
    ...
    +  target_entity_type_id: constants/target_type
    ...
    +  target_bundle: constants/target_type
    

    Is there a standard for adding quoting values. In this yml file and others is it not done and in others it is done. Not sure what to do or are both allowed?

  4. +++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php
    @@ -24616,7 +24908,7 @@
    -  'hidden' => '0',
    +  'hidden' => '-1',
    

    Can you explain why this change is needed?

  5. +++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php
    @@ -24775,14 +25079,14 @@
    -  'link_title' => 'Configure block',
    +  'link_title' => 'Configure',
    ...
    -  'weight' => '0',
    +  'weight' => '-100',
    

    Can you explain why these changes are needed?

  6. +++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php
    @@ -25065,33 +25389,8 @@
    -->values(array(
    -  'menu_name' => 'navigation',
    -  'mlid' => '174',
    -  'plid' => '172',
    -  'link_path' => 'search/user',
    -  'router_path' => 'search/user',
    -  'link_title' => 'Users',
    -  'options' => 'a:0:{}',
    -  'module' => 'system',
    -  'hidden' => '-1',
    -  'external' => '0',
    -  'has_children' => '0',
    -  'expanded' => '0',
    -  'weight' => '0',
    -  'depth' => '2',
    -  'customized' => '0',
    -  'p1' => '172',
    -  'p2' => '174',
    -  'p3' => '0',
    -  'p4' => '0',
    -  'p5' => '0',
    -  'p6' => '0',
    -  'p7' => '0',
    -  'p8' => '0',
    -  'p9' => '0',
    -  'updated' => '0',
    
    @@ -25281,33 +25592,8 @@
    -->values(array(
    -  'menu_name' => 'navigation',
    -  'mlid' => '182',
    -  'plid' => '174',
    -  'link_path' => 'search/user/%',
    -  'router_path' => 'search/user/%',
    -  'link_title' => 'Users',
    -  'options' => 'a:0:{}',
    -  'module' => 'system',
    -  'hidden' => '-1',
    -  'external' => '0',
    -  'has_children' => '0',
    -  'expanded' => '0',
    -  'weight' => '0',
    -  'depth' => '3',
    -  'customized' => '0',
    -  'p1' => '172',
    -  'p2' => '174',
    -  'p3' => '182',
    -  'p4' => '0',
    -  'p5' => '0',
    -  'p6' => '0',
    -  'p7' => '0',
    -  'p8' => '0',
    -  'p9' => '0',
    -  'updated' => '0',
    

    Why is these menu items removed?

  7. +++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php
    @@ -31491,13 +32233,15 @@
    -  'router_path' => 'node/2',
    +  'router_path' => 'node/%',
    

    The same for this change: why is this done?

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new3.63 KB
new77.34 KB

65.1 Fixed
65.2 The 5 is I18N_MODE_MULTIPLE, defined in 18n.module.

// No multilingual options
define('I18N_MODE_NONE', 0);
// Localizable object. Run through the localization system
define('I18N_MODE_LOCALIZE', 1);
// Predefined language for this object and all related ones.
define('I18N_MODE_LANGUAGE', 2);
// Multilingual objects, translatable but not localizable.
define('I18N_MODE_TRANSLATE', 4);
// Objects are translatable (if they have language or localizable if not)
define('I18N_MODE_MULTIPLE', I18N_MODE_LOCALIZE | I18N_MODE_TRANSLATE);

65.3 YAML does not require quotes for scalars so I prefer not to use them. Drupal does not have a standard about quotes in yaml.
65.4 -> 64.7. When I make changes to the fixture I normally do it by bringing up a d6 or d7 site and make the changes via the UI to make sure they are correct. That leads to all kinds of changes in the fixture that I need to make sure are not in the patch and sometimes I miss changes. I have removed the ones you identified.

quietone’s picture

Version: 8.9.x-dev » 9.1.x-dev
daffie’s picture

Status: Needs review » Reviewed & tested by the community

@quietone: Thank you for the explanations.

All the code changes now look good to me.
It is for me RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed e72c88f and pushed to 9.1.x. Thanks!

  • alexpott committed e72c88f on 9.1.x
    Issue #3110669 by quietone, ravi.shankar, Gábor Hojtsy, catch, xjm,...
quietone’s picture

@alexpott, Thanks!

quietone’s picture

Just tidying up the related issues and fixing that parent issue.

tr’s picture

StatusFileSize
new686 bytes

The commit in #70 introduced a regression - it uses public static $modules in the test instead of protected static $modules.

It's a quick fix - can this be fixed here, or should I open a new issue?

daffie’s picture

@TR: I think that it is better to open a new issue and link it to this issue as a followup.

tr’s picture

Mmm, OK, I posted the fixes in #3164721: More uses of public static $modules. Maybe you can review that @daffie?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

quietone’s picture

Over in #3112249: Migrate d7 menu translation larowlan asks if that issue should be backported to 9.0.x. If that is to be done it would be easier if this was ported first because this contains needed fixture changes.

mikelutz’s picture

Title: Migrate d7 menu language content settings » [backport] Migrate d7 menu language content settings
Status: Closed (fixed) » Reviewed & tested by the community
Issue tags: +Needs release manager review

Leaving this for RM review on whether we can back-port to 9.0

benjifisher’s picture

Version: 9.1.x-dev » 9.0.x-dev

Should the status be "Patch (to be ported)"?

I am changing the target branch to 9.0.x.

quietone’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new893 bytes
new77.29 KB

Let's get a working patch for 9.0.x

mikelutz’s picture

Status: Needs review » Reviewed & tested by the community

Thank you, @quietone! To recap for the RMs: This patch contains a new migration for the menu language content settings, a bunch of tests, and updates to the fixture. While not technically a bug fix, and would ordinarily not be eligible for a backport to 9.0, the new migration enhances support for D7 migrations, which we've traditionally considered backports for as its good for the ecosystem to make it as easy as possible to get people off of D7 into modern Drupal. Also, the fixture changes are needed to backport #3112249: Migrate d7 menu translation, which contains another needed D7 i18n migration, which is being considered for backport. None of this is runtime code, so from that perspective, it is safe to backport, but this and the other issue will help make it easier for people to run migrations from D7 to D9.0 right now, so I'm in favor of the backport to 9.0 and 8.9, but leaving it to @xjm and @catch to approve or deny. If this is approved and committed, We would then put the other issue up for backport as well, so a up/down on both would be great.

Originally this was committed to 9.0 (When that was the active dev branch) and backported to 8.9 (again while that was still in -dev). It had to be reverted due to a regression that has been fixed, so we need a new determination from the RMs as to whether it still qualifies for backport and how far back it should be backported.

mikelutz’s picture

quietone’s picture

Adding clarification for the remaining i18n migrations. There are three of these issues that could be backported and they need to be done in this order. One reason is because of the fixture changes.

  1. #3110669: Migrate d7 menu language content settings
  2. #3112249: Migrate d7 menu translation
  3. #3008028: Migrate D7 i18n menu links
wim leers’s picture

9.1.0 was released nine days ago. I don't think backporting is still relevant?

Version: 9.0.x-dev » 9.1.x-dev

Drupal 9.0.10 was released on December 3, 2020 and is the final full bugfix release for the Drupal 9.0.x series. Drupal 9.0.x will not receive any further development aside from security fixes. Sites should update to Drupal 9.1.0 to continue receiving regular bugfixes.

Drupal-9-only bug reports should be targeted for the 9.1.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.2.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Yes moving this back to 'fixed' on 9.1.x

benjifisher’s picture

Title: [backport] Migrate d7 menu language content settings » Migrate d7 menu language content settings

Then let's also remove "[backport]" from the title.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.