You are here

function aggregator_form_opml_validate in Drupal 7

Form validation handler for aggregator_form_opml().

See also

aggregator_form_opml_submit()

File

modules/aggregator/aggregator.admin.inc, line 302
Administration page callbacks for the Aggregator module.

Code

function aggregator_form_opml_validate($form, &$form_state) {

  // If both fields are empty or filled, cancel.
  if (empty($form_state['values']['remote']) == empty($_FILES['files']['name']['upload'])) {
    form_set_error('remote', t('You must <em>either</em> upload a file or enter a URL.'));
  }

  // Validate the URL, if one was entered.
  if (!empty($form_state['values']['remote']) && !valid_url($form_state['values']['remote'], TRUE)) {
    form_set_error('remote', t('This URL is not valid.'));
  }
}