function menu_import_file in Menu Export/Import 7
Import menu from text file.
Parameters
$uri: uri of the uploaded file.
$menu_name: iternal name of the menu.
$options: An associative array of import options. See menu_import_save_menu for reference.
Return value
array An associative array of result.
- error: in case of error, this will contain an array of error messages;
- deleted_nodes: count of nodes deleted;
- matched_nodes: count of nodes matched;
- new_nodes: count of nodes created;
- unknown_links: count of menu items with internal links (not nodes);
- external_links: count of menu items with external links.
See also
menu_import_save_menu
1 call to menu_import_file()
File
- ./
menu_import.module, line 85 - Module's main file, general definitions and hooks.
Code
function menu_import_file($uri, $menu_name, array $options) {
module_load_include('inc', 'menu_import', 'includes/import');
$menu = menu_import_parse_menu_from_file($uri, $menu_name, $options);
// Stop import on any errors.
if ($menu['errors']) {
return array(
'errors' => $menu['errors'],
);
}
$result = menu_import_save_menu($menu, $options);
if (!empty($menu['warnings'])) {
$result['warnings'] = $menu['warnings'];
}
return $result;
}