Community Documentation

Menu migration

Last updated March 11, 2013. Created by mikeryan on October 22, 2012.
Edited by pearlbear. Log in to edit this page.

Menu migration defines no arguments beyond the common ones. Menus themselves just have names, titles, and descriptions to migrate.

<?php
$menu_arguments
= $common_arguments + array(
 
'machine_name' => 'ExampleMenu',
 
'description' => t('Import Drupal 6 menus'),
);
Migration::registerMigration('DrupalMenu6Migration',
 
$menu_arguments['machine_name'], $menu_arguments);
?>

Menu links are more complex, and require a few arguments:

  • menu_migration: The machine name for your menu migration, so links get assigned to the correct menu.
  • node_migrations: An optional array of node migrations, required in order to update nids in link_path.
  • term_migrations: An optional array of term migrations, required in order to update tids in link_path.

<?php
$menu_link_arguments
= $common_arguments + array(
 
'machine_name' => 'ExampleMenuLink',
 
'description' => t('Import Drupal 6 menu links'),
 
'menu_migration' => 'ExampleMenu',
 
'node_migrations' => array('ExamplePhotoNode', 'ExampleVideoNode'),
 
'term_migrations' => array('ExamplePhotoTerm', 'ExampleVideoTerm'),
);

Migration::registerMigration('DrupalMenuLinks6Migration',
 
$menu_link_arguments['machine_name'], $menu_link_arguments);
?>

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 7.x
Audience
Programmers
Level
Intermediate, Advanced
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.