You are here

protected function DrupalMenuLinksMigration::createStub in Drupal-to-Drupal data migration 7.2

Creates a stub menu link, for when a child is imported before its parent

Parameters

$migration: The source migration

Return value

int $mlid on success FALSE on failure

File

./menu_links.inc, line 83
Base class for migrating menu links into Drupal.

Class

DrupalMenuLinksMigration

Code

protected function createStub($migration) {

  // if plid is 0, that means it has no parent, so don't create a stub
  if (!$migration->sourceValues->plid) {
    return FALSE;
  }
  $menu_link = array(
    'menu_name' => $migration->sourceValues->menu_name,
    'link_path' => 'stub-path',
    'router_path' => 'stub-path',
    'link_title' => t('Stub title'),
  );
  $mlid = menu_link_save($menu_link);
  if ($mlid) {
    return array(
      $mlid,
    );
  }
  else {
    return FALSE;
  }
}