function menu_links_clone

7.x menu_links_clone($links, $menu_name = NULL)

Clones an array of menu links.


$links: An array of menu links to clone.

$menu_name: (optional) The name of a menu that the links will be cloned for. If not set, the cloned links will be in the same menu as the original set of links that were passed in.

Return value

An array of menu links with the same properties as the passed-in array, but with the link identifiers removed so that a new link will be created when any of them is passed in to menu_link_save().

See also


Related topics

2 calls to menu_links_clone()
shortcut_set_add_form_submit in drupal/modules/shortcut/
Submit handler for shortcut_set_add_form().
shortcut_set_switch_submit in drupal/modules/shortcut/
Submit handler for shortcut_set_switch().


drupal/includes/, line 2926
API for the Drupal menu system.


function menu_links_clone($links, $menu_name = NULL) {
  foreach ($links as &$link) {
    if (isset($menu_name)) {
      $link['menu_name'] = $menu_name;
  return $links;