function openlayers_ui_admin_settings_validate in Openlayers 7.2
Settings form validation
_state
Parameters
$form:
File
- modules/
openlayers_ui/ includes/ openlayers_ui.admin.inc, line 122 - This file holds the functions for the main openlayers Admin settings.
Code
function openlayers_ui_admin_settings_validate($form, &$form_state) {
if ($form_state['values']['openlayers_source_type'] == 'external') {
$url = $form_state['values']['openlayers_source_external'];
// If protocol neutral, fake a URL that will pass valid_url() and
// url_is_external().
if (strpos($url, '//') === 0) {
$url = 'http:' . $url;
}
if (!valid_url($url, TRUE) && !url_is_external($url)) {
form_set_error('openlayers_source_external', 'The source must be a valid external URL, beginning with http(s).');
}
}
}