1

Currently I'm trying to migrate content (both nodes and menu items) from my old CMS (non Drupal CMS) to my D7 instance. In that light, I have exported the menu items as JSON files and I have also created the migration classes using migrate module and a third party one called Integration (https://github.com/nuvoleweb/integration/). I followed the same procedure for the content which I have imported into my D7 successfully. The problem that occurred regarding the menu links is the following:


In order to import menu items I use the MigrateDestinationMenuLinks method provided by migration module. The menu items should be imported along with their translations where it should be used entity translation. During the import phase, I get following error:

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /ECBWEB_instance/batch_de?id=514&op=do StatusText: OK ResponseText: Fatal error: Call to undefined method MigrateDestinationMenuLinks::getEntityType() in /var/www/html/ECBWEB_instance/sites/all/modules/integration-7.x-1.x/modules/integration_migrate/src/AbstractMigration.php on line 30

While this happens I noticed that the menu item has been migrated but only in one language (language neutral) and not the rest of the others. The aforementioned error seems to reveals that migration module does not provide menu import methods for entity translations. Below you can find the class I've made in order to migrate the menu items (from JSON to Drupal)

public function __construct($arguments = array()) {
parent::__construct($arguments);
$this->setMap(new MigrateSQLMap(
  $this->getMachineName(),
  array(
    'mlid' => array(
      'type' => 'varchar',
      'not null' => TRUE,
      'length' => 255,
    ),
  ),
  MigrateDestinationMenuLinks::getKeySchema()
));

$this->setDestination(new MigrateDestinationMenuLinks('menu-a-menu'));
$this->addFieldMapping('menu_name')->defaultValue('menu-a-menu');
$this->addFieldMapping('language', 'default_language');
$this->addFieldMapping('router_path')->defaultValue('node/%');
$this->addFieldMapping('plid', 'parent_id')->sourceMigration($this->getMachineName());
$this->addFieldMapping('link_title', 'subject');
$this->addFieldMapping('link_path','internal_url');
$this->addFieldMapping('weight','weight');

// Get the current folder and path
$json_folder = DRUPAL_ROOT . '/' .
drupal_get_path('module', 'migrate_example') . '/json/menu/';

$list_class = new MigrateListJSON($json_folder . 'list.json');
$item_class = new MigrateItemJSON($json_folder . 'menu-:id.json');
$this->setSource(new MigrateSourceList($list_class, $item_class));
}

Has anyone was ever in position to migrate menu items configured with entity translation? I'm stuck in this point a lot of days now and the documentation for migration of menu items is very poor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.