You are here

function menu_import_form_step1_submit in Menu Export/Import 7

Step 1 form submit handler.

1 string reference to 'menu_import_form_step1_submit'
menu_import_form_step1 in includes/admin.inc
Step 1 of menu import process.

File

includes/admin.inc, line 242
Administrative page callbacks for menu_import module.

Code

function menu_import_form_step1_submit($form, &$form_state) {
  $form_state['storage']['options'] = array(
    'create_content' => $form_state['values']['create_content'],
    'link_to_content' => $form_state['values']['link_to_content'],
    'remove_menu_items' => $form_state['values']['remove_menu_items'],
    'language' => $form_state['values']['language'],
    'node_type' => $form_state['values']['node_type'],
    'node_body' => $form_state['values']['node_body'],
    'node_format' => $form_state['values']['node_format'],
    'node_author' => $form_state['values']['node_author'],
    'node_status' => $form_state['values']['node_status'],
    'node_alias' => $form_state['values']['node_alias'],
  );
  module_load_include('inc', 'menu_import', 'includes/import');
  $text = $form_state['values']['text'];
  $menu_name = $form_state['values']['menu_name'];
  $options = $form_state['storage']['options'];
  if ($text) {
    $menu = menu_import_parse_menu_from_string(trim($text), $menu_name, $options);
  }
  else {
    $file = $form_state['values']['file'];
    $menu = menu_import_parse_menu_from_file($file->uri, $menu_name, $options);
    file_delete($file);
  }
  if (!empty($menu['errors'])) {
    foreach ($menu['errors'] as $error) {
      drupal_set_message(check_plain($error), 'error');
    }
  }
  if (!empty($menu['warnings'])) {
    foreach ($menu['warnings'] as $warn) {
      drupal_set_message($warn, 'warning');
    }
  }
  $form_state['storage']['menu'] = $menu;
  $form_state['storage']['step'] = 2;
  $form_state['rebuild'] = TRUE;
  $form_state['page_values'][1] = $form_state['values'];
}