I have tried this using migrate and building menu.inc and menu_links.inc files based on the examples in migrate_d2d. I have also tried to migrate menus and menu links using migrate_d2d and I've gotten exactly the same results.

Only 17 of 1415 menu links are migrated. All others are ignored, even when I set migrate to update existing links. It appears that links in the D6 primary and secondary links menus get passed. But no links in the navigation menu are passed to D7. I get no error messages, so I don't know why 1398 links are ignored.

Comments

rsbecker’s picture

I solved the problem. In the migration I created a new menu for my old nav menu, which includes most menu links created thru the UI that point to site content.

Nothing in the documentation discusses mapping old menus to new ones. Migrate_d2d maps primary-links to main-menu and secondary-links to user-menu(?)' but not the others.

mikeryan’s picture

Sorry, I've never used the menu migration stuff myself - anyone in the community who has have any insight?

rsbecker’s picture

It's not a problem. I figured out what I did wrong.

I think there is a need for some documentation. That is a todo in the handbook pages.

techysafi’s picture

now Im trying to figure out what i am doing wrong :/ same problem here... most of the menu links are being ignored.

any changes you had to make in code level?

rsbecker’s picture

Here's what I did.
1. Create a map of menus on the D7 site that correspond to menus on the D6 site.

  // D7 machine_names on the left.
  protected $sourceMenus = array(
    'devel' => 'devel',
    'features' => 'features',
    'main-menu' => 'primary-links',
    'navigation' => 'navigation', 
    'user-menu' => 'secondary-links',
    'site_menu' => 'menu-global-nav',  // this is where your site-specific menu will go.
  );

Then I pirated the menu and menu_links classes from migrate_d2d, replacing the following code at the bottom of the menu.inc file:

    // D6 prefixes menus added through the UI with 'menu-'
    if ($row->menu_name == 'secondary-links' ||
        substr($row->menu_name, 0, 5) === 'menu-') {
      return TRUE;
    }
    else {
      return FALSE;
    }

with the following:

    //Translate menu names
    $row->menu_name = rsb_migrate_get_menu_name($row->menu_name);

Then, in the menu_links.inc comment out the following:

    $this->addFieldMapping('menu_name', 'menu_name');

In the query for basic menu_links data add the following condition to get only links from the menus you plan to migrate:

    $query->condition('m.menu_name', array('menu-global-nav', 'primary-links', 'secondary-links'), 'IN');

In my case all of the site-specific links were in the D6 site's menu-global-nav.
In the code that steps thru the D6 site menu links replace the following:

    if (!($row->menu_name == 'primary-links' ||
        $row->menu_name == 'secondary-links' ||
        substr($row->menu_name, 0, 5) == 'menu-')) {
      return FALSE;
    }

    if ($row->menu_name == 'primary-links') {
      $row->menu_name = 'main-menu';
    }

with a call to the function that translates menu names:

    //translate menu names
    $row->menu_name = rsb_migrate_get_menu_name($row->menu_name);

That will create the new site-menu on the D7 site and migrate primary- and secondary-links menus. It will also rename the main- and user-menus. I'm sure there is a way to keep the D7 names, main-menu and user-menu, but I wasn't concerned enough to figure it out.

I hope this helps

techysafi’s picture

 protected $sourceMenus = array(
    'devel' => 'devel',
    'features' => 'features',
    'main-menu' => 'primary-links',
    'navigation' => 'navigation',
    'user-menu' => 'secondary-links',
    'site_menu' => 'menu-global-nav',  // this is where your site-specific menu will go.
  );

where do i put this property? feeling lost :/

rsbecker’s picture

You could put it above the construstor. If you have a my_migration.migrate.inc file you could put it in an abstract class. Then call it from node.inc.

mikeryan’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

No open question left here....

berenddeboer’s picture

Having the same problem with all links being ignored, the issue seems to be that the router_path field is not filled.

It's not filled in the source either. In the cases I have examined this so far, the router_path is empty for an alias or external link in D6.

nerdcore’s picture

Status: Closed (works as designed) » Needs work

Sorry to re-open this, but I've also stumbled upon this issue.

While reading migrate_d2d/d6/menu_link.inc I am curious what the purpose is behind Line #81:

79: if (!($row->menu_name == 'primary-links' ||
80:   $row->menu_name == 'secondary-links' ||
81:   substr($row->menu_name, 0, 5) == 'menu-')) {

Why does migrate_d2d only migrate D6 menus "primary-links", "secondary-links", and "menu-*"? Why not "navigation"?

nerdcore’s picture

Version: 7.x-2.0 » 7.x-2.1
Component: Code » Documentation
coterj’s picture

I am having a similar issue- I tried posting about it under a new topic last week. However I wasn't getting any traction on that posting. If any of you see this- could you take a look at my posting?

https://www.drupal.org/node/2834087

coterj’s picture

Happy New Year everyone- has anyone had a chance to look at the posting I made here around 3 weeks ago? (^^^its right above this posting I could still use some guidance if anyone has time?