There are lots of _url() and _l() calls still outstanding inside comments/documentation:

_url()

core/lib/Drupal/Core/Routing  (3 usages found)
    UrlGeneratorInterface.php  (3 usages found)
        (69: 67) *   - 'entity_type': The entity type of the object that called _url(). Only
        (70: 17) *     set if _url() is invoked by Drupal\Core\Entity\Entity::uri().
        (72: 33) *     generated. Only set if _url() is invoked by Drupal\Core\Entity\Entity::uri().
core/modules/views/src/Plugin/views/field  (1 usage found)
    FieldPluginBase.php  (1 usage found)
        (1244: 56) // Make sure that paths which were run through _url() work as well.

l()

core/lib/Drupal/Core/Menu  (1 usage found)
    LocalTaskManager.php  (1 usage found)
        (266: 26) // Normally, _l() compares the href of every link with the current
core/lib/Drupal/Core/Render/Element  (4 usages found)
    Link.php  (4 usages found)
        (37: 60) *   A structured array whose keys form the arguments to _l():
        (38: 55) *   - #title: The link text to pass as argument to _l().
        (40: 62) *   - #options: (optional) An array of options to pass to _l() or the link
        (47: 44) // By default, link options to pass to _l() are normally set in #options.
core/modules/language/src/Tests  (4 usages found)
    LanguageSwitchingTest.php  (4 usages found)
        (295: 32) // Test links generated by _l() on an English page.
        (320: 32) // Test links generated by _l() on a French page.
        (356: 32) // Test links generated by _l() on an English page.
        (375: 32) // Test links generated by _l() on a French page.
core/modules/language/tests/language_test/src/Controller  (1 usage found)
    LanguageTestController.php  (1 usage found)
        (74: 64) * Using #type 'link' causes these links to be rendered with _l().
core/modules/link/src/Plugin/Field/FieldFormatter  (2 usages found)
    LinkFormatter.php  (1 usage found)
        (193: 26) // by default in _l().
    LinkSeparateFormatter.php  (1 usage found)
        (58: 26) // by default in _l().
core/modules/link/src/Tests  (1 usage found)
    LinkFieldTest.php  (1 usage found)
        (386: 8) // _l() and options/attributes. Only 'url_plain' has a dependency on
core/modules/simpletest/src  (1 usage found)
    TestBase.php  (1 usage found)
        (864: 20) // Not using _l() to avoid invoking the theme system, so that unit tests
core/modules/system  (4 usages found)
    language.api.php  (1 usage found)
        (98: 46) * translated link text before going through _l(), which will just handle the
    menu.api.php  (2 usages found)
        (355: 64) *   - options: (optional) An array of options to be passed to _l() when
        (377: 58) *   - localized_options: An array of options to pass to _l().
    system.api.php  (1 usage found)
        (510: 69) *   exposed as the 'link_generator' service or a link generated by _l(). If the
core/modules/system/src/Tests/Common  (12 usages found)
    UrlTest.php  (12 usages found)
        (18: 59) * \Drupal\Component\Utility\UrlHelper::buildQuery(), and _l() work correctly
        (36: 113) $this->assertTrue(strpos($link, $sanitized_path) !== FALSE, format_string('XSS attack @path was filtered by _l().', array('@path' => $path)));
        (71: 51) // Test the active class in links produced by _l() and #type 'link'.
        (91: 62) $this->assertTrue(isset($links[0]), 'A link generated by _l() to the current page is marked active.');
        (94: 62) $this->assertTrue(isset($links[0]), 'A link generated by _l() to the current page with a query string when the current page has no query string is not marked active.');
        (98: 62) $this->assertTrue(isset($links[0]), 'A link generated by _l() to the current page with a query string that matches the current query string is marked active.');
        (101: 62)  _l()
        (104: 62) $this->assertTrue(isset($links[0]), 'A link generated by _l() to the current page without a query string when the current page has a query string is not marked active.');
        (106: 56) // Test adding a custom class in links produced by _l() and #type 'link'.
        (107: 13) // Test _l().
        (132: 26) // Build a link with _l() for reference.
        (135: 42) // Test a renderable array passed to _l().
core/modules/system/src/Tests/Theme  (1 usage found)
    FunctionsTest.php  (1 usage found)
        (174: 35) // Turn off the query for the _l() function to compare the active
core/modules/system/tests/modules/common_test/src/Controller  (1 usage found)
    CommonTestController.php  (1 usage found)
        (22: 64) * Using #type 'link' causes these links to be rendered with _l().
core/modules/views/src/Plugin/views/field  (1 usage found)
    FieldPluginBase.php  (1 usage found)
        (1445: 44) // convert back to an array form for _l().
core/modules/views/src/Tests  (1 usage found)
    ViewStorageTest.php  (1 usage found)
        (188: 36) // Enable the system module so _l() can work using url_alias table.

We should get these cleaned up.

Only normal because it doesn't render the system, or any part of the system, unusable.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Vijayac’s picture

Assigned: Unassigned » Vijayac
Issue tags: +SprintWeekend2015

working on this issue

Vijayac’s picture

Working on this issue

webchick’s picture

chilukuri, do you have a patch to upload by chance? Otherwise, this would make good fodder for people at the DrupalCamp NJ sprint happening now.

webchick’s picture

Title: Remove remaining _l() calls in comments/documentation » Remove remaining url() and _l() calls in comments/documentation
Issue summary: View changes

Also, expanding scope, adding an up-to-date grep to issue summary.

YesCT’s picture

Assigned: Vijayac » Unassigned

thanks for trying this.

un-assigning since it has been a while.
If you have questions or partial work, please make a comment on the issue.

webchick’s picture

Issue summary: View changes

Updated issue summary with a new grep that optimistically reflects the codebase after #2343669: Remove _l() and _url() makes it in.

webchick’s picture

Issue summary: View changes

$indentation--;

hussainweb’s picture

Status: Active » Needs review
FileSize
9.58 KB

I got here from #2424525: Remove references to _l() and _url(). Man, what a nice number! It's a pity to see that closed. :)

I am uploading the patch from #2424525-1: Remove references to _l() and _url() here to get things started.

webchick’s picture

LOL oh, dang! Yes that node ID is clearly superior. :) Thanks so much for tackling this!

hussainweb’s picture

Note to reviewers:

+++ b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
@@ -66,10 +66,6 @@
-   *   - 'entity_type': The entity type of the object that called _url(). Only
-   *     set if _url() is invoked by Drupal\Core\Entity\Entity::uri().
-   *   - 'entity': The entity object (such as a node) for which the URL is being
-   *     generated. Only set if _url() is invoked by Drupal\Core\Entity\Entity::uri().

These doesn't seem to be used at all. I couldn't find the uri() methods on Entity class, and the similarly named url() method had no reference to this properties nor any other function call that might work up on this.

mpdonadio’s picture

@hussainweb, do you think you caught all of them or are you still working on this? I'm not going to work on this issue directly so I can do proper reviews instead.

hussainweb’s picture

@mpdonadio: No, I had actually mentioned this in my other comment but forgot to copy it here. Basically, I am calling it a day and plan to catch the remaining tomorrow. I just wanted to get started on this.

hussainweb’s picture

Status: Needs review » Needs work

Setting to Needs Work accordingly.

ifrik’s picture

Should this be taken up during the sprints at DrupalCon Barcelona?

If so, then it should be tagged with Barcelona2015.

mpdonadio’s picture

Issue tags: +Barcelona2015, +Needs reroll

Yeah, this slipped through the cracks. Current patch doesn't apply either. Since _url() and _l() are long gone, usages need to be found with search and/or grep.

alvar0hurtad0’s picture

Assigned: Unassigned » alvar0hurtad0

start working on reroll

alvar0hurtad0’s picture

Assigned: alvar0hurtad0 » Unassigned
Issue tags: -Needs reroll
FileSize
8.83 KB

Here's the reroll.

hussainweb’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 17: remove_remaining_url-2410497-17.patch, failed testing.

Status: Needs work » Needs review
hussainweb’s picture

It's a random failure as the changes are only in comments. Retesting...

hussainweb’s picture

It's a random failure as the changes are only in comments. Retesting...

DuaelFr’s picture

Issue tags: +Novice
adancillo’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Render/Element/Link.php
@@ -38,17 +38,18 @@ public function getInfo() {
+    // By default, link options to pass to the link generator are normally set

Should this contain the full class name?

Nitebreed’s picture

Title: Remove remaining url() and _l() calls in comments/documentation » Update remaining url() and _l() calls in comments/documentation

The provided patch is not only removing the calls but updating the documentation, so therefore I'm updating the title.

wizonesolutions’s picture

I mentored on this issue.

jhodgdon’s picture

Status: Needs work » Reviewed & tested by the community

I think it's OK as it is. Thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

After applying the patch I still appear to have 22 occurences of _l() - for example in core/modules/system/src/Tests/Common/UrlTest.php
And 3 occurrences of _url() all in core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php

alvar0hurtad0’s picture

alvar0hurtad0’s picture

Status: Needs work » Needs review
FileSize
14.85 KB
23 KB

And this fixing #28 report

jhodgdon’s picture

Status: Needs review » Needs work

Thanks! I checked and I think this patch covers all the _url() and _l() calls now... not 100% sure about _url() because I checked with grep, nad there are a lot of other functions called things like check_url() etc. that complicated things... but fairly sure. _l() is definitely covered.

So... The new patch looks mostly OK but there are a few problems:

  1. +++ b/core/lib/Drupal/Core/Language/language.api.php
    @@ -159,7 +159,7 @@
    + * translated link text before going through the link generator, which will just handle the
    

    This documentation line goes over 80 characters, and needs to be rewrapped.

  2. +++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
    @@ -267,7 +267,7 @@ public function getLocalTasksForRoute($route_name) {
    +            // Normally, the link generator compares the href of every link with the current
    

    over 80 characters in code comment lines is also a standards violation. Needs rewrap.

  3. +++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
    @@ -275,7 +275,7 @@ public function getLocalTasksForRoute($route_name) {
    -              // This tab has visible children
    +              // This tab has visible children.
    

    This change is technically out of scope for the issue... but that's probably OK.

  4. +++ b/core/lib/Drupal/Core/Menu/menu.api.php
    @@ -437,9 +439,10 @@ function hook_system_breadcrumb_alter(\Drupal\Core\Breadcrumb\Breadcrumb &$bread
    + *   "route link", 'route_name' will be set, otherwise 'path' will be set.
    

    maybe fix the punctuation here too? It should be:

    ... will be set; otherwise, 'path' ...

  5. +++ b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
    @@ -66,10 +66,11 @@
    +   *   - 'entity_type': The entity type of the object that called the URL generator.
    +   *     Only set if the URL generator is invoked by Drupal\Core\Entity\Entity::uri().
    

    over 80 characters, rewrap.

    Also, class name should start with \

  6. +++ b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
    @@ -66,10 +66,11 @@
    +   *     Drupal\Core\Entity\Entity::uri().
    

    Class name should start with \

  7. +++ b/core/modules/system/src/Tests/Common/UrlTest.php
    @@ -102,7 +103,8 @@ function testLinkAttributes() {
    +    // Test the active class in links produced by \Drupal\Core\Utility\LinkGeneratorInterface::generate()
    

    over 80 chars, rewrap

  8. +++ b/core/modules/system/src/Tests/Common/UrlTest.php
    @@ -122,23 +124,23 @@ function testLinkAttributes() {
    +    // Test adding a custom class in links produced by \Drupal\Core\Utility\LinkGeneratorInterface::generate() and #type 'link'.
    

    over 80 chars, rewrap

  9. +++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php
    @@ -172,7 +172,7 @@ function testItemList() {
    +    // Turn off the query for the \Drupal\Core\Utility\LinkGeneratorInterface::generate() method to compare the active
    

    over 80 chars, rewrap

  10. +++ b/core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php
    @@ -19,7 +19,7 @@ class CommonTestController {
    +   * Using #type 'link' causes these links to be rendered with the link generator.
    

    over 80 chars, rewrap

  11. +++ b/core/modules/views/src/Tests/ViewStorageTest.php
    @@ -185,7 +185,7 @@ protected function displayTests() {
    +    // Enable the system module so the link generator can work using url_alias table.
    

    over 80 chars, rewrap

mpdonadio’s picture

I stubbed _url() and _l() back into common.inc and ran a usage report in PhpStorm w/ the patch applied and didn't get and results. Also searched for ' _l(' and ' _url(' and didn't see anything. I'm confident the patch caught everything, but I did not review the actual patch.

jhodgdon’s picture

Most of what is being fixed here (if not all) is references in docs and comments, so I doubt PhpStorm would find it ?

alvar0hurtad0’s picture

Status: Needs work » Needs review
FileSize
7.37 KB
23.36 KB

Thanks for your revision and your time.

This is the patch with fixed on #31

mpdonadio’s picture

Find Usages in PhpStorm will catch @see references, which is why I also ran text searches on those specific strings to double check the grep/ag checks.

jhodgdon’s picture

Status: Needs review » Needs work

Almost there! Two spots still need a quick fix:

  1. +++ b/core/lib/Drupal/Core/Routing/UrlGeneratorInterface.php
    @@ -66,10 +66,12 @@
    +   *     Drupal\Core\Entity\Entity::uri().
    

    This class name still needs to start with \

  2. +++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php
    @@ -172,7 +172,7 @@ function testItemList() {
    +    // Turn off the query for the \Drupal\Core\Utility\LinkGeneratorInterface::generate() method to compare the active
    

    This is still over 80 characters and needs rewrapping.

sdstyles’s picture

Status: Needs work » Needs review
FileSize
23.45 KB
1.47 KB
jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! Looks good now.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Yay, so happy to see this RTBC!

Committed and pushed to 8.0.x. Thanks!

  • webchick committed e5424fb on 8.0.x
    Issue #2410497 by alvar0hurtad0, sdstyles, hussainweb, webchick,...

Status: Fixed » Closed (fixed)

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