You are here

function menu_import_form_step1_validate in Menu Export/Import 7

Step 1 form validate handler.

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

File

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

Code

function menu_import_form_step1_validate($form, &$form_state) {
  $node_types = node_type_get_names();
  if ($form_state['values']['create_content'] && empty($node_types)) {
    form_set_error('create_content', t('No content types were found, cannot create initial content.'));
  }
  $validators = array(
    'file_validate_extensions' => array(
      'txt',
    ),
  );
  if (empty($form_state['values']['text'])) {
    $file = file_save_upload('upload', $validators);
    if (!$file) {
      form_set_error('upload', t('You must select a valid text file to upload.'));
    }
    else {
      $form_state['values']['file'] = $file;
    }
  }
}