function menu_import_string in Menu Export/Import 7
Import menu from text variable.
Parameters
$text: string containing the menu structure.
See also
File
- ./
menu_import.module, line 110 - Module's main file, general definitions and hooks.
Code
function menu_import_string($text, $menu_name, array $options) {
module_load_include('inc', 'menu_import', 'includes/import');
$menu = menu_import_parse_menu_from_string($text, $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;
}