You are here

function devel_generate_menus in Devel 7

Generates new menus.

2 calls to devel_generate_menus()
devel_generate_menu_form_submit in devel_generate/devel_generate.module
FormAPI submission to generate menus.
drush_devel_generate_menus in devel_generate/devel_generate.drush.inc
Command callback. Generate a number of menus and menu links.

File

devel_generate/devel_generate.inc, line 359

Code

function devel_generate_menus($num_menus, $title_length = 12) {
  $menus = array();
  if (!module_exists('menu')) {
    $num_menus = 0;
  }
  for ($i = 1; $i <= $num_menus; $i++) {
    $menu = array();
    $menu['title'] = devel_generate_word(mt_rand(2, max(2, $title_length)));
    $menu['menu_name'] = 'devel-' . drupal_strtolower($menu['title']);
    $menu['description'] = t('Description of @name', array(
      '@name' => $menu['title'],
    ));
    menu_save($menu);
    $menus[$menu['menu_name']] = $menu['title'];
  }
  return $menus;
}