You are here

function menu_import_export_menu in Menu Export/Import 7

Same name and namespace in other branches
  1. 6 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.

2 calls to menu_import_export_menu()
drush_menu_import_export in ./menu_import.drush.inc
menu_import_export_form_submit in includes/export.inc
Menu export handler.

File

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

Code

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

  // Here we bypass access control and i18n filtering of links
  // based on current/default language.
  $tree = _menu_build_tree($menu_name);
  $tree = $tree['tree'];

  // 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,
      )),
    );
  }
}