menu_links_clone

Versions
7
menu_links_clone($links, $menu_name = NULL)

Clone an array of menu links.

See also

menu_link_save()

Parameters

$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().

Related topics

▾ 1 function calls menu_links_clone()

shortcut_set_switch_submit in modules/shortcut/shortcut.admin.inc
Submit handler for the form that switches shortcut sets.

Code

includes/menu.inc, line 2435

<?php
function menu_links_clone($links, $menu_name = NULL) {
  foreach ($links as &$link) {
    unset($link['mlid']);
    unset($link['plid']);
    if (isset($menu_name)) {
      $link['menu_name'] = $menu_name;
    }
  }
  return $links;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.