You are here

function content_menu_node_insert in Content Menu 8

Same name and namespace in other branches
  1. 7 content_menu.module \content_menu_node_insert()

Implements hook_node_insert().

After creating a new node, if it's being created to replace a menu-dummy, perform the replacement.

File

./content_menu.module, line 364

Code

function content_menu_node_insert($node) {

  // Ensure that this node is replacing a menu dummy.
  if (isset($_GET['menu_link_path']) && $_GET['menu_link_path'] == 'menu-dummy') {

    // Update the dummy that is being replaced by this node.
    $menu_item = content_menu_get_menu_item_from_querystring();
    $menu_item['link_path'] = "node/" . $node->nid;
    content_menu_link_save($menu_item);
  }
}