1 redirect.admin.inc redirect_edit_form_validate($form, &$form_state)

Form validate handler; validate an URL redirect

See also

redirect_edit_form()

File

core/modules/redirect/redirect.admin.inc, line 574
Administrative page callbacks for the Redirect module.

Code

function redirect_edit_form_validate($form, &$form_state) {
  form_state_values_clean($form_state);
  $redirect = new Redirect($form_state['values']);

  if (empty($form_state['values']['override'])) {
    if ($existing = redirect_load_by_source($redirect->source, $redirect->langcode)) {
      if ($redirect->rid != $existing->rid && $redirect->langcode == $existing->langcode) {
        // The "from" path should not conflict with another redirect
        $form_state['storage']['override_messages']['redirect-conflict'] = t('The base source path %source is already being redirected. Do you want to <a href="@edit-page">edit the existing redirect</a>?', array('%source' => $redirect->source, '@edit-page' => url('admin/config/urls/redirect/edit/' . $existing->rid)));
        $form_state['rebuild'] = TRUE;
      }
    }
  }

  redirect_validate($redirect, $form, $form_state);
  $form_state['redirect'] = $redirect;
}