Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
As of https://docs.google.com/document/d/1BxgNvyIRcxYGzzA1DLkZ6A4-c8gGFixypNvP... we want to make clear which bits of the URL generation
machinery should be used
\Drupal::l() is one of them
Proposed resolution
* mark \Drupal::l() as deprecated, see #2605546: Mark \Drupal::url() as deprecated for a related example
* Point to \Drupal\Core\Link instead
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#15 | 2606376-15.patch | 653 bytes | rakesh.gectcr |
#10 | 2606376-10.patch | 639 bytes | rakesh.gectcr |
#9 | 2606376-9.patch | 626 bytes | rakesh.gectcr |
#4 | 2606376-4.patch | 511 bytes | Himanshu5050 |
#3 | 2606376-3.patch | 551 bytes | sdstyles |
Comments
Comment #2
dawehnerComment #3
sdstyles CreditAttribution: sdstyles at FFW commentedComment #4
Himanshu5050 CreditAttribution: Himanshu5050 at Publicis Sapient for Publicis Sapient commentedComment #5
joshi.rohit100@Himanshu5050 - Please try to upload the interdiff as well as I couldn't tell the difference between #3 and #4
Comment #6
nicrodgersThe patch in #3 looks good to me. The patch in #4 has less information (does not say when it will be removed). So #3 RTBC
Comment #7
nicrodgersActually...feedback on #3
Would be helpful (and consistent with the other example) to provide more information, such as:
Instead create a \Drupal\Core\Url object directly, for example using Url::fromRoute().
Comment #8
rakesh.gectcrComment #9
rakesh.gectcr@nicrodgers,
I have updated your comments #6 and #7.
Comment #10
rakesh.gectcrI have modified the example of usage;
Comment #11
jhodgdonDeciding that something is deprecated is not a Documentation issue.
Comment #12
dawehner@jhodgdon
Well this was already totally decided, so you think the deprecation step is its own thing and should be still discussed?
Comment #13
dawehnerYou should use the Link object instead ...
Let's use
$link = Link::fromTextAndUrl($text, $url);
as exampleComment #14
dawehnerComment #15
rakesh.gectcr@dawehner
I updated the patch according to above comments.
Comment #16
rakesh.gectcrComment #17
dawehnerThank you
Comment #18
dawehner.
Comment #21
xjmI think it does make sense to file the deprecations against their respective component.
Committed and pushed to 8.1.x and 8.0.x (with the addition of the missing word "and" fixed on commit). Thanks all for working on this!