You are here

function redirect_element_validate_redirect in Redirect 7.2

Same name and namespace in other branches
  1. 7 redirect.admin.inc \redirect_element_validate_redirect()

Element validate handler; validate the redirect of an URL redirect.

See also

redirect_edit_form()

1 string reference to 'redirect_element_validate_redirect'
redirect_edit_form in ./redirect.admin.inc
Form builder to add or edit an URL redirect.

File

./redirect.admin.inc, line 498
Administrative page callbacks for the redirect module.

Code

function redirect_element_validate_redirect($element, &$form_state) {
  $value =& $element['#value'];
  _redirect_extract_url_options($element, $form_state);
  $value =& $form_state['values']['redirect'];

  // Normalize the path.
  $value = drupal_get_normal_path($value, $form_state['values']['language']);
  if (!valid_url($value) && !valid_url($value, TRUE) && $value != '<front>' && $value != '' && !file_exists($value)) {
    form_error($element, t('The redirect path %value is not valid.', array(
      '%value' => $value,
    )));
  }
  return $element;
}