You are here

public function DrupalMenuLinks6Migration::__construct in Drupal-to-Drupal data migration 7.2

Parameters

array $arguments: $arguments['menu_migration'] should be defined -- menu links are normally dependent on menus.

Overrides DrupalMenuLinksMigration::__construct

File

d6/menu_links.inc, line 18
Implementation of DrupalMenuLinksMigration for Drupal 6 sources.

Class

DrupalMenuLinks6Migration

Code

public function __construct(array $arguments) {
  parent::__construct($arguments);

  // Most mappings are straightforward
  $this
    ->addSimpleMappings(array(
    'router_path',
    'link_title',
    'module',
    'hidden',
    'external',
    'has_children',
    'expanded',
    'weight',
    'depth',
    'customized',
    'p1',
    'p2',
    'p3',
    'p4',
    'p5',
    'p6',
    'p7',
    'p8',
    'p9',
    'updated',
  ));

  /*    // If menus have been migrated, menu_name is taken from menu_migration.
      // Otherwise, we can assume we are only adding to existing menus.
      // @todo: Would anyone ever migrate menu_links but not menu, or can we make it
      //   a forced dependency?
      if (!empty($arguments['menu_migration'])) {
        $menu_migration = $arguments['menu_migration'];
        $this->addFieldMapping('menu_name', 'menu_name')
             ->sourceMigration($menu_migration);
      }
      else {
        $this->addFieldMapping('menu_name', 'menu_name');
      }
   */
  $this
    ->addFieldMapping('menu_name', 'menu_name');

  // plid is taken from this migration. If the parent hasn't yet been migrated,
  // we need to create a stub.
  $this
    ->addFieldMapping('plid', 'plid')
    ->sourceMigration($this
    ->getMachineName());

  // @todo: What do we do if pathing changes? Can/Should we make this dependent on
  //   an implementation of MigratePathEntityHandler, if it exists?
  // Most likely this will involve a callback.
  $this
    ->addFieldMapping('link_path', 'link_path');

  // Ran into trouble with options, so I'm leaving it out for now
  $this
    ->addUnmigratedSources(array(
    'options',
  ));
  $this
    ->addUnmigratedDestinations(array(
    'options',
  ));
}