function aggregator_form_opml_validate
Form validation handler for aggregator_form_opml().
See also
File
-
modules/
aggregator/ aggregator.admin.inc, line 302
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.'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.