Skip to content

Instantly share code, notes, and snippets.

@Sam152
Last active August 29, 2015 14:27
Show Gist options
  • Save Sam152/3d51d51d78cdf07d4033 to your computer and use it in GitHub Desktop.
Save Sam152/3d51d51d78cdf07d4033 to your computer and use it in GitHub Desktop.
Replicate Snippet for fleshing out brochure website menus
<?php
$main_menu_links = menu_load_links('main-menu');
foreach ($main_menu_links as $menu_item) {
if ($menu_item['link_path'] == 'node/1' && $menu_item['link_title'] !== 'Home') {
$new_node = node_load(replicate_entity_by_id('node', 1));
$new_node->title = $menu_item['link_title'];
$menu_item['link_path'] = 'node/' . $new_node->nid;
menu_link_save($menu_item);
node_save($new_node);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment