Commit 2605f7e6 authored by Nathan Haug's avatar Nathan Haug
Browse files

Whitespace now allowed (but trimmed later) in URL entry. Issue #92249.

parent cb10aa65
...@@ -157,7 +157,7 @@ function link_widget($op, &$node, $field, &$node_field) { ...@@ -157,7 +157,7 @@ function link_widget($op, &$node, $field, &$node_field) {
foreach($node_field as $delta => $value) { foreach($node_field as $delta => $value) {
if ($value['url']) { if ($value['url']) {
// Validate the link // Validate the link
if (!link_validate_link($value['url'])) { if (!link_validate_link(trim($value['url']))) {
form_set_error($field['field_name'] .']['. $delta. '][value][url', t('Not a valid URL.')); form_set_error($field['field_name'] .']['. $delta. '][value][url', t('Not a valid URL.'));
} }
// Require a title for the link if necessary // Require a title for the link if necessary
...@@ -226,6 +226,8 @@ function _link_widget_process (&$node_field, $delta = 0) { ...@@ -226,6 +226,8 @@ function _link_widget_process (&$node_field, $delta = 0) {
if (!$node_field['attributes']['target'] || $node_field['attributes']['target'] == "default") { if (!$node_field['attributes']['target'] || $node_field['attributes']['target'] == "default") {
unset($node_field['attributes']['target']); unset($node_field['attributes']['target']);
} }
// Trim whitespace from URL
$node_field['url'] = trim($node_field['url']);
} }
/** /**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment