You are here

function gathercontent_create_menu_item in GatherContent 7.2

Create a menu link for importing hierarchy

1 call to gathercontent_create_menu_item()
gathercontent_import_page in includes/pages_import.inc
AJAX function to process individual pages.

File

includes/pages_import.inc, line 532
Contains page field mapping form.

Code

function gathercontent_create_menu_item($link_title, $parent, $link_path) {
  if ($parent != '0' && $parent != '_imported_page_') {
    $menu = explode(':', $parent);
    if (count($menu) > 1) {
      $link = array(
        'link_path' => $link_path,
        'link_title' => $link_title,
        'menu_name' => $menu[0],
        'parent' => $parent,
        'plid' => $menu[1],
      );
      $mlid = menu_link_save($link);
      if (!$mlid) {
        drupal_set_message(t('There was an error saving the menu link.'), 'error');
      }
      else {
        return $link['menu_name'] . ':' . $mlid;
      }
    }
  }
  return '';
}