You are here

function asset_wizard_form_submit in Asset 6

Same name in this branch
  1. 6 asset_wizard.inc \asset_wizard_form_submit()
  2. 6 inc/asset_wizard.inc \asset_wizard_form_submit()
Same name and namespace in other branches
  1. 5 asset_wizard.inc \asset_wizard_form_submit()

Submit callback for asset_wizard_form().

File

./asset_wizard.inc, line 784

Code

function asset_wizard_form_submit($form_id, $form_values) {

  // If the user presses 'back' or 'cancel' don't do any submission work...
  if ($form_values['op'] == t(ASSET_WIZARD_PREVIOUS) || $form_values['op'] == t(ASSET_WIZARD_CANCEL)) {
    return FALSE;
  }
  if ($form_values['op'] == t('New Folder')) {
    $dir = file_create_path($form_values['parent'] . '/' . $form_values['folder']);
    if (!asset_check_directory($dir, FILE_CREATE_DIRECTORY, 'folder')) {
      drupal_set_message(t('Error creating %dir.', array(
        '%dir' => $dir,
      )));
    }
    return FALSE;
  }
  if ($form_values['step'] == 1 && isset($form_values['module'])) {

    // allow module submits to return an aid
    $retval = module_invoke($form_values['module'], 'asset_type', 'submit', $form_values['delta'], $form_values);
    if (is_numeric($retval)) {
      $_POST['aid'] = $retval;
    }
    return FALSE;
  }

  // If we haven't processed the form and completed fully, we have
  // to return FALSE so that Drupal redisplays our form.
  return FALSE;
}