You are here

function menu_import_export_menu in Menu Export/Import 6

Same name and namespace in other branches
  1. 7 includes/export.inc \menu_import_export_menu()

Exports menu to a string.

Parameters

$menu_name string name of the menu to be exported.:

$options array export options.:

Return value

array either the textual representation of the menu as 'menu' or error description as 'errors' key value.

1 call to menu_import_export_menu()
menu_import_export_form_submit in includes/export.inc
Menu export handler.

File

includes/export.inc, line 103
Export functions for menu_import module.

Code

function menu_import_export_menu($menu_name, $options) {
  global $me_options;
  $me_options = $options;
  $tree = menu_tree_all_data($menu_name);

  // Menu contains items.
  if (count($tree)) {
    $output = '';
    _menu_import_export_recurse($tree, 0, $output);
    return array(
      'menu' => $output,
    );
  }
  else {
    return array(
      'errors' => t('Menu @menu contains no items.', array(
        '@menu' => $menu_name,
      )),
    );
  }
}