Problem/Motivation

Followup to #2574981: Fix grammar ("an URL" should be "a URL") and consistent use of URL (not "url" / "Url") in documentation only, part 1: There are still a significant number of inline and docblock comments in core that lowercase "url" in sentences.

Proposed resolution

Correct the lowercase word "url" to "URL" where it is used in a sentence as a word (not referring to machine names, array keys, etc.)

[ayrton:drupal | Thu 15:33:42] $ grep -r " url" * | grep "\* " | grep -v "vendor" | grep -v "node_modules"

These still have lowercase uses that need to be changed:

core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php:   * Enhances test urls with schemes.
core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php:   *   The list of urls.
core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php:   * Enhances test urls with prefixes.
core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php:   *   The list of urls.
core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php:   * Tests detecting external urls that point to local resources.
core/includes/theme.inc: *     route_name + route_parameters or url (path), language, and query options
core/lib/Drupal/Core/Entity/Controller/EntityController.php:   * The url generator.
core/lib/Drupal/Core/Mail/MailFormatHelper.php:   * Internal array of urls replaced with tokens.
core/lib/Drupal/Core/Routing/RouteProvider.php:   * restrictions on the url. That case is considered a not found - returning
core/lib/Drupal/Core/Routing/RouteProvider.php:   *   RouteCollection with all urls that could potentially match $request.
core/lib/Drupal/Core/Routing/UrlGenerator.php:   * The path processor to convert the system path to one suitable for urls.
core/lib/Drupal/Core/Routing/UrlGenerator.php:   *   The path processor to convert the system path to one suitable for urls.
core/lib/Drupal/Core/Routing/RouteProviderInterface.php:   * restrictions on the url. That case is considered a not found - returning
core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php:   *   The url generator.
core/lib/Drupal/Core/Utility/LinkGenerator.php:   *   The url generator.
core/lib/Drupal/Core/Utility/LinkGenerator.php:   *   The link text, url, and other options.
core/modules/file/tests/src/Kernel/FileUrlTest.php: * Tests the file url.
core/themes/olivero/templates/navigation/menu.html.twig: *   - url: The menu link url, instance of \Drupal\Core\Url
core/themes/olivero/templates/navigation/menu--primary-menu.html.twig: *   - url: The menu link url, instance of \Drupal\Core\Url
core/themes/olivero/templates/navigation/menu--secondary-menu.html.twig: *   - url: The menu link url, instance of \Drupal\Core\Url

From:

[ayrton:drupal | Thu 15:40:35] $ grep -r " url" * | grep " // " | grep -v "vendor" | grep -v "node_modules"
core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php:    // Set the update url. This must be set here rather than in
core/tests/Drupal/Tests/BrowserTestBase.php:    // Generate a route to prime the url generator with the correct base url.
core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php:      // Invalid destination urls.
core/lib/Drupal/Core/Form/ConfirmFormHelper.php:        // Suppress the exception and fall back to the form's cancel url.
core/lib/Drupal/Core/Asset/JsOptimizer.php:    // Remove JS source and source mapping urls or these may cause 404 errors.
core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php:      // entity's url. Since we don't know what the markup of the entity will
core/lib/Drupal/Core/Command/DbCommandBase.php:    // Load connection from a url.
core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php:      // removed from the url.
core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php:        // Ensure that resource link contains url with the alias field.
core/modules/file/tests/src/Functional/DownloadTest.php:    // Try requesting the private file url without a file specified.
core/modules/views_ui/tests/src/Functional/DisplayPathTest.php:    // Links should be url-encoded.
core/modules/views_ui/src/ViewEditForm.php:      // Find out the first display which has a changed path and redirect to this url.
core/modules/toolbar/tests/src/Nightwatch/Tests/toolbarApiTest.js:        // Clear escapeAdmin url values.
core/modules/toolbar/tests/src/Nightwatch/Tests/toolbarTest.js:        // Clear escapeAdmin url values.
core/modules/language/tests/src/Functional/LanguageBrowserDetectionAcceptLanguageTest.php:    // Set language detection to url and browser detection.
core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php:    // from overwriting the url.
core/modules/user/tests/src/Functional/UserPasswordResetTest.php:    // Ensure that the current url does not contain the hash and timestamp.
core/modules/user/src/Plugin/views/argument_validator/UserName.php:    // argument so it works for example for generation summary urls.
core/modules/forum/src/Controller/ForumController.php:          // the url.
core/modules/system/tests/src/Functional/System/AdminTest.php:    // match the redirected url.
core/modules/system/tests/src/Kernel/Mail/MailTest.php:    // Test root relative urls.
core/modules/system/tests/src/Kernel/Mail/MailTest.php:    // Test protocol relative urls.
core/modules/system/tests/src/Kernel/Mail/MailTest.php:    // Test absolute urls.
core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php:    // Retrieve the autocomplete url.
core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php:    // Visit the view's page url and validate the results.
core/modules/ckeditor5/ckeditor5.module:        // CSS url is external or relative to Drupal root.
core/modules/ckeditor5/ckeditor5.module:        // CSS url is relative to theme.
core/modules/filter/filter.module:  // and allow @ in a url, but only in the middle. Catch things like http://example.com/@user/
core/modules/node/tests/src/Functional/NodeTranslationUITest.php:    // Need to check from the beginning, including the base_path, in the url
core/modules/views/js/ajax_view.js:        // If there is a '?' in ajaxPath, clean url are on and & should be
core/modules/views/js/base.js:    // Get viewPath url without baseUrl portion.
core/modules/views/js/base.js:    // 3 is the length of the '?q=' added to the url without clean urls.
core/modules/views/tests/src/Functional/Plugin/DisplayTest.php:    // Test more link with absolute url.
core/modules/views/tests/src/Functional/Plugin/DisplayTest.php:    // Test more link with query parameters in the url.
core/modules/views/tests/src/Functional/Plugin/DisplayTest.php:    // Test more link with fragment in the url.
core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:    // Return the display URL if there is no custom url.
core/modules/views/src/Plugin/views/display/DisplayPluginBase.php:    // Create url.

Remaining tasks

  1. First, fix the above cases of lowercased "url" in core docs.
  2. Followup to discuss and potentially fix "Url" in sentences (which may in some cases refer to a Drupal\Core\Url object).

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork drupal-3336780

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

xjm created an issue. See original summary.

xjm’s picture

Issue tags: +Needs followup

Tagging for the part 3 issue (for "Url") once this scope is addressed.

xjm’s picture

Issue summary: View changes

Remove false positive.

xjm’s picture

Issue summary: View changes
diegors’s picture

Assigned: Unassigned » diegors

Working on it.

diegors’s picture

Assigned: diegors » Unassigned
Status: Active » Needs review

Did some changes, needs review.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Change looks good but could someone open the follow up per #2 please.

xjm’s picture

Status: Needs work » Needs review

Followup posted. Going to discuss how to review this with @schlaukopf now.

xjm’s picture

Status: Needs review » Active

So the merge request includes a lot of changes from Url to URL, which is out of scope. We should only be fixing the lowercase url in this issue, because the uppercase version was a bit contentious.

Since the merge request seems to include many of these incorrect changes, I suggest we close it and start over with a new merge request that focuses only on the lowercase instances of url as listed in the issue summary. Thanks!

schlaukopf’s picture

Assigned: Unassigned » schlaukopf

I will start working on this, I will create a new merge request to focus only on the lowercase instances of url.

schlaukopf’s picture

Status: Active » Needs review

I made the changes, It needs review

schlaukopf’s picture

Assigned: schlaukopf » Unassigned
xjm’s picture

Issue tags: -Needs followup
fabiansierra5191’s picture

Status: Needs review » Reviewed & tested by the community

Following the path of this ticket was not easy, the previous one has a lot of comments and some perspectives but after research, I can say that the changes made on this ticket look like the best based on some Drupal documentation and considering the discussion of why "URL" should be capitalized this way in code documentation:

  • catch committed c0cc344f on 10.1.x
    Issue #3336780 by diegors, schlaukopf, xjm, fabiansierra5191: Correctly...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Resolved a merge conflict, and committed c0cc344 and pushed to 10.1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.