function devel_generate_menu_form_submit in Devel 7
FormAPI submission to generate menus.
File
- devel_generate/
devel_generate.module, line 505
Code
function devel_generate_menu_form_submit($form, &$form_state) {
// If the create new menus checkbox is off, set the number of new menus to 0.
if (!isset($form_state['values']['existing_menus']['__new-menu__']) || !$form_state['values']['existing_menus']['__new-menu__']) {
$form_state['values']['num_menus'] = 0;
}
module_load_include('inc', 'devel_generate');
// Delete custom menus.
if ($form_state['values']['kill']) {
devel_generate_delete_menus();
drupal_set_message(t('Deleted existing menus and links.'));
}
// Generate new menus.
$new_menus = devel_generate_menus($form_state['values']['num_menus'], $form_state['values']['title_length']);
if (!empty($new_menus)) {
drupal_set_message(t('Created the following new menus: !menus', array(
'!menus' => implode(', ', $new_menus),
)));
}
// Generate new menu links.
$menus = $new_menus + $form_state['values']['existing_menus'];
$new_links = devel_generate_links($form_state['values']['num_links'], $menus, $form_state['values']['title_length'], $form_state['values']['link_types'], $form_state['values']['max_depth'], $form_state['values']['max_width']);
drupal_set_message(t('Created @count new menu links.', array(
'@count' => count($new_links),
)));
}