Experiencing weird behaviour with migrated menu items.
I have a migration script that runs after installation which adds a link to the contact form (/contact path).
In the database this appears as menu_tree.url = 'base:contact' instead of menu_tree.route_name = 'contact.site_page'.

After a manual cache clear (in the UI, note: doesn't work with drush cr..), the route_name is magically filled in to 'contact.site_page'.

This migration of menu items used to work in Drupal 8.1 but is broken in 8.2.

The links appear but they aren't indicated as active. In the database route_name is empty (should be "contact.site_page") and route is "base:contact".

The csv source:

id;language;menu_name;link_title;link_path;description;external;weight;expanded;enabled;options
1;en;secondary-navigation;"Contact us";contact;"";0;0;1;1;
2;en;secondary-navigation;"FAQ";faq;"";0;1;1;1;
3;en;footer;"External link";"http://drupal.org/";"";1;0;1;1;
4;en;footer;"Contact us";contact;"";0;1;1;1;

The migrate yaml:

source:
  plugin: csv
  default_lang: true
  path: private://migrate/custom/menu_links_paths.csv
  delimiter: ;
  enclosure: '"'
  escape: "\\"
  header_row_count: 1
  keys:
    - id
  column_names:
    0:
      id: Id
    1:
      language: Language code
    2:
      menu_name: Menu name
    3:
      link_title: Link title
    4:
      link_path: Path
    5:
      description: Description
    6:
      external: External
    7:
      weight: Weight
    8:
      expanded: Expanded
    9:
      enabled: Enabled
    10:
      options: Options
    11:
      route_name: Route name
destination:
  plugin: entity:menu_link_content
  default_bundle: menu_link_content
  no_stub: true
  translations: true
process:
  langcode: language
  title: link_title
  description: description
  menu_name: menu_name
  options_source:
    plugin: explode
    source: options
    delimiter: ,
  'link/uri':
    plugin: link_uri
    source:
      - link_path
  'link/options': options
  route:
    plugin: route
    source:
      - link_path
      - options
  route_name: route_name
  route_parameters: '@route/route_parameters'
  url: '@route/url'
  options: '@route/options'
  external: external
  weight: weight
  expanded: expanded
  enabled: enabled
destination:
  plugin: entity:menu_link_content
  default_bundle: menu_link_content
  no_stub: true
migration_dependencies:
  required:
    - menu

Comments

mpp created an issue. See original summary.

mpp’s picture

Issue summary: View changes
mpp’s picture

Status: Active » Closed (duplicate)
mpp’s picture

Status: Closed (duplicate) » Active
mpp’s picture

Issue summary: View changes
skuark’s picture

Experiencing the exact same issue that mpp reports: menu links migration working with 8.1.x not working properly after update to 8.2.x. Clearing cache from UI, not with drush, fixes the problem.

If you look at the table menu_tree before and after clearing caches with UI, you can see some differences: https://gist.github.com/skuark/2f5b4a2bfb092274178a32ef1ead0700

mpp’s picture

@skuark: do you have any patches applied, what version of Drush do you have?

In my case I had Drush Version 8.1.5, I recently updated to 8.1.7 which seems to have resolved the issue.

skuark’s picture

@mpp: I have one patch for the metatag module (https://www.drupal.org/files/issues/metatag-deactivate_drupalconsole_ser...), but nothing related to that.

I had Drush 8.1.2. I've tested again with Drush 8.1.7 but the problem persists. Anyway, now with drush 8.1.7 the cache clearing is working properly, but with Drupal 8.1.x I didn't need to clear caches after migration.

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.

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

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.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.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.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.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

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

heddn’s picture

Status: Active » Postponed (maintainer needs more info)

Is this still an issue?

mpp’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

This is no longer an issue.