function defaultcontent_import_menu_link in Default Content 7
Same name and namespace in other branches
- 7.2 defaultcontent.module \defaultcontent_import_menu_link()
imports a new menu item
3 calls to defaultcontent_import_menu_link()
- content_menu_links_features_rebuild in ./
defaultcontent.features.inc - Implements hook_features_export_rebuild().
- defaultcontent_cron in ./
defaultcontent.module - Implements hook_cron().
- menu_item_post_import in plugins/
menu_item.inc - Handles the importing of menu item after the node is loaded
File
- ./
defaultcontent.module, line 313 - Module file for the Default content module which allow export and import of default content in a Drupal site.
Code
function defaultcontent_import_menu_link($key, $link) {
module_load_include('inc', 'features', 'includes/features.menu');
if (variable_get('node_content_enabled', FALSE)) {
$key = defaultcontent_alter_identifier($key, FALSE);
$existing = features_menu_link_load($key);
if ($existing) {
$link['mlid'] = $existing['mlid'];
}
else {
$link['mlid'] = 0;
}
if (isset($link['parent_path'])) {
$link['parent_path'] = defaultcontent_alter_path($link['parent_path'], 0);
}
$link['link_path'] = defaultcontent_alter_path($link['link_path'], 0);
$menu_links_prime[$key] = $link;
if (!empty($link['parent_path']) && ($parent = features_menu_link_load("{$link['menu_name']}:{$link['parent_path']}"))) {
$link['plid'] = $parent['mlid'];
}
else {
$link['plid'] = 0;
}
if ($mid = menu_link_save($link)) {
return TRUE;
}
}
return FALSE;
}