Issue #2431085 by xjm, pjbaert, Jo Fitzgerald: Validation error for manually entered paths in the link widget is a little confusing

8.7.x
Nathaniel Catchpole 2018-11-28 12:55:56 +00:00
parent 87646bb85a
commit 94098ff42e
3 changed files with 3 additions and 3 deletions

View File

@ -139,7 +139,7 @@ class LinkWidget extends WidgetBase {
// @todo '<front>' is valid input for BC reasons, may be removed by
// https://www.drupal.org/node/2421941
if (parse_url($uri, PHP_URL_SCHEME) === 'internal' && !in_array($element['#value'][0], ['/', '?', '#'], TRUE) && substr($element['#value'], 0, 7) !== '<front>') {
$form_state->setError($element, t('Manually entered paths should start with /, ? or #.'));
$form_state->setError($element, t('Manually entered paths should start with one of the following characters: / ? #'));
return;
}
}

View File

@ -147,7 +147,7 @@ class LinkFieldTest extends BrowserTestBase {
// Define some invalid URLs.
$validation_error_1 = "The path '@link_path' is invalid.";
$validation_error_2 = 'Manually entered paths should start with /, ? or #.';
$validation_error_2 = 'Manually entered paths should start with one of the following characters: / ? #';
$validation_error_3 = "The path '@link_path' is inaccessible.";
$invalid_external_entries = [
// Invalid protocol

View File

@ -105,7 +105,7 @@ class MenuLinkContentFormTest extends BrowserTestBase {
],
t('Save')
);
$this->assertText(t('Manually entered paths should start with /, ? or #.'));
$this->assertText(t('Manually entered paths should start with one of the following characters: / ? #'));
}
}