#2324121: NodeType's settings array was meant to be able to store information from mutliple modules is making the "which menus are available for a node type" part of the node type config entity by using the new third party settings API.

In D6, we only had a single setting, for the default menu (menu_default_node_menu), I think we need to do something similar to menu_update_7000() to make sure that the setting still makes sense in 8.x?

For D7, we will need to migrate them from the old per-node-type variables (as seen in the update function) to third party settings. In general, we possibly need support for those on config entities.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jarsenx’s picture

Assigned: Unassigned » jarsenx
ultimike’s picture

Some initial research:

1. In D6, we need to migrate the "menu_default_node_menu" variable. This is set on admin/build/menu/settings ("Default menu for content").

2. In D7, there are 2 related variables per content type for default menu settings:

a. menu_options_{content type}
b. menu_parent_{content type}

3. In D8, there are 2 related configuration values per content type for default menu settings:

a. third_party_settings.menu_ui.available_menus
b. third_party_settings.menu_ui.parent

The logic used in menu_update_7000() in D7/modules/menu/menu.install is something like this:

If the menu listed in "menu_default_node_menu" still exists then
  $default_node_menu = value of menu_default_node_menu
  Loop around all content types 
    if "menu_options_{content type}" doesn't exist then
      variable_set('menu_options_' . $type, array($default_node_menu));
      variable_set('menu_parent_' . $type, $default_node_menu . ':0');

Therefore, the logic for D6->D8 should be something like this:

  $default_node_menu = value of menu_default_node_menu
  Loop around all content types 
    if "third_party_settings.menu_ui.available_menus" doesn't exist for the content type then
      third_party_settings.menu_ui.available_menus = array($default_node_menu));
      third_party_settings.menu_ui.parent = '$default_node_menu:'

So, for the D6->D8 migration...

This migration must be run for each content type, so I don't think adding "menu_default_node_menu" as a source variable to migrate_drupal/config/install/d6_menu_settings.yml is the right way to go.

I'm pretty sure we need to modify the d6_node_type source plugin to grab the menu_default_node_menu variable and create new source properties for available_menus and parent. Then, in the d6_node_type.yml, we need to map these new source properties to their corresponding configurations. Give it a shot and let me know.

-mike

jarsenx’s picture

Issue status update

ultimike gave me a patch to try for solving this issue. I applied the patch and ran the migration, now I want to describe my approach and the results I observed.

Preparation

  1. Created a fresh install of Drupal 6.34.
    • Installed Drupal 6.34 and configured it.
    • Installed and enabled the Content and Link modules.<.li>
    • On the admin/build/menu/settings page: changed the Default menu for content setting to Secondary links.
    • Created a new content type named Column with the default content type fields.
    • Created three pieces of content -- a Column, a Page, and a Story.
  2. Created a fresh install of Drupal 8.0.x-Dev
    • Dropped the existing mysql database.
    • Executed the command: `git reset --hard HEAD` in the Drupal 8.0.x root directory.
    • Executed the command: `git pull origin 8.0.x`.
    • Executed the command: `drush site-install standard...`.
    • Applied the patch I got from ultimike.
    • Installed the migrate and migrate_drupal modules.
  3. Created a manifest file to migrate the Nodes and Node types and placed it in the Drupal 8 site root folder:
          # Node type
          - d6_node_type
          - d6_field
          - d6_field_formatter_settings
          - d6_field_instance_widget_settings
          - d6_field_instance
          - d6_filter_format
          - d6_view_modes
          - d6_node_settings
          - d6_node
        

Running the migration

Running d6_node_type [ok]
Running d6_field [ok]
Running d6_field_instance [ok]
Running d6_view_modes [ok]
Running d6_field_formatter_settings [ok]
Running d6_field_instance_widget_settings [ok]
Running d6_filter_format [ok]
Running d6_node_settings [ok]
Running d6_node [ok]

Results

  1. The three content types were migrated from D6 to D8. However, the Page content type from D6 replaced the Basic Page content type in Drupal 8.
  2. The three pieces of content were migrated from D6 to D8. However, the Parent item menu setting in each one has no value. (The dropdown displays `<>`.)
  3. The configuration settings for each migrated content type contains this value:
    third_party_settings:
                      menu_ui:
                        available_menus:
                          - secondary-links
                        parent: 'secondary-links:'
        

Questions

  1. Are there any problems with the testing approach?
  2. Why does the D6 Page content type overwrite the D8 Basic Page content type instead of creating a new one?
  3. Why is the menu Parent item for each piece of migrated content set to a null value?
ultimike’s picture

Joe,

In part 1 above, you said, "I tried setting the menu Parent item for each piece of content but when I save them they keep reverting to Secondary links." - I tried to reproduce this behavior, but couldn't. Setting the parent menu item appeared to work fine for me.

Can you attach the patch here? It's been awhile since we worked on it and I don't have it anymore...

Thanks,
-mike

jarsenx’s picture

Hmm, I'll take another look at setting the menu Parent item values in D6.
Here's the patch.

Thanks.

--Joe

quietone’s picture

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

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mikeryan’s picture

Assigned: jarsenx » quietone
quietone’s picture

On a first look the approach in the existing patch looks reasonable. And a list of things to do.

TODO:

D6

  • Add variable "menu_default_node_menu" to the dump. Note this is set on admin/build/menu/settings ("Default menu for content").
  • Reroll patch
  • Add tests

D7

  • The two variables, menu_options_{content type} and menu_parent_{content type}, exist in the dump with default data. Something should be changed for testing.
  • Add tests
  • Make a patch
quietone’s picture

Status: Active » Needs review
FileSize
10.37 KB

Thanks to ultimike's thorough notes in #2 it was straightforward to build on the patch by jarsenx.

This has migrations for d6 and d7 and the tests.

Status: Needs review » Needs work

The last submitted patch, 12: 2333985-12.patch, failed testing.

quietone’s picture

Looks like menu_ui needs to be enabled for all the failed migration tests.

quietone’s picture

Status: Needs work » Needs review
FileSize
37.48 KB
19.43 KB

Added menu_ui to $modules in the tests. Hopefully, I fixed them all.

quietone’s picture

Assigned: quietone » Unassigned

Unassigning so someone can review.

heddn’s picture

Assigned: Unassigned » heddn

Assigning to myself for review. If someone else get to it before me, don't feel stopped from doing your own review.

heddn’s picture

Assigned: heddn » Unassigned
Status: Needs review » Reviewed & tested by the community

This pulls over the data from D6 & D7 just fine. Tests look complete.

The last submitted patch, 5: menu_default_node_menu.patch, failed testing.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.4.x and cherry-picked to 8.3.x. Thanks!

  • catch committed 5875eb5 on 8.4.x
    Issue #2333985 by quietone, jarsenx, ultimike, heddn: Migrate...

Status: Fixed » Closed (fixed)

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