Sub-issue of #2339219: [meta] Finalize URL generation API (naming, docs, deprecation)
Problem/Motivation
Most uses of l()
and url()
should be converted to supported alternatives in #2340251: Remove most remaining url() calls and #2343651: Remove most remaining l() calls. However, we need to ensure that module developers know that the procedural functions are deprecated before releasing a beta.
Proposed resolution
If any uses of l()
or url()
remain by the beta deadline date (Sept. 28):
- Convert what uses we can.
- Rename
l()
to_l()
and mark it deprecated - Rename
url()
to_url()
and mark it deprecated. - Clearly document both in the docblocks and the change record what
l()
andurl()
should be replaced with in all Drupal 7 usecases, including:- An internal path that matches an existing route, in procedural and class code.
- An external URL.
- Code that can accept either an internal or external URL.
- Providing an URL to a "internal" (relative/absolute) url but not controlled by the Drupal routing system. (Edgecase, probably can just be converted to
generateFromPath()
which might be changed later but is not beta-blocking).
Remaining tasks
TBD
User interface changes
None.
API changes
l()
and url()
are deprecated and should no longer be used.
Postponed until
#2340251: Remove most remaining url() calls
#2343651: Remove most remaining l() calls
Comment | File | Size | Author |
---|---|---|---|
#23 | l-docs-fix.patch | 1.57 KB | effulgentsia |
#17 | 2343661.15.patch | 140.54 KB | alexpott |
#15 | 2343661-l-url-15.patch | 140.54 KB | tim.plunkett |
#14 | url-l-external-2343759-2.biscuit2.patch | 196.41 KB | larowlan |
#14 | l-url.do-not-test.patch | 140.54 KB | larowlan |
Comments
Comment #1
xjmComment #2
xjmComment #3
xjmComment #4
catchComment #5
MustangGB CreditAttribution: MustangGB commentedBlockers are fixed, not sure why this is still postponed.
Comment #6
catch#2343759: Provide an API function to replace url()/l() for external urls and others aren't fixed yet, there's no way to do the documentation part of this.
Comment #7
tim.plunkettThis is a simple rename that will apply on top of #2343759: Provide an API function to replace url()/l() for external urls.
Not marking needs review until then.
The docs replacements are really indicative of stale docs that really are talking about link or url generator.
Comment #8
larowlanCan we get a combined patch (here or on a patch testing issue) to see if this is green on top of #2343759: Provide an API function to replace url()/l() for external urls ?
Should we be adding @deprecated and 'documenting replacements' as per issue title?
>80
Comment #9
larowlanstab at docs, patch is against #2343759: Provide an API function to replace url()/l() for external urls
interdiff is against #7
Comment #10
larowlanminor change
Comment #11
larowlanhere's the patch at #10 plus the patch at #2343759: Provide an API function to replace url()/l() for external urls for a test-bot run.
Comment #12
effulgentsia CreditAttribution: effulgentsia commentedLooks great to me. Just one nit:
Perhaps the above can be fixed on commit or if this gets rerolled.
Comment #14
larowlanfixes #12
Comment #15
tim.plunkettThe do not test patch from #14, just in case someone is nervous about the bot.
Comment #16
alexpottComment #17
alexpottCome on bot
Comment #18
alexpottThanks testbot
Comment #19
alexpottCommitted 002ae71 and pushed to 8.0.x. Thanks!
Minor docs fixed on commit
Comment #20
webchickDANCE DANCE DANCE!! :D
Comment #21
JohnAlbinWOOT!
Comment #23
effulgentsia CreditAttribution: effulgentsia commentedOops. When I reviewed earlier, I missed that our _l() docs additions were also failing to pass the $text parameter in the example code.
I'm also unclear why we're telling people to call \Drupal::linkGenerator()->generate() when none of core does that, and lots of places in core call the shorter \Drupal::l() instead, so this changes the doc to match what core actually does.
So, can we get this docs fix in before the beta gets tagged? While this isn't actually critical or beta blocking, I'm leaving the issue attributes alone, to get this in front of a committer prior to beta.
Comment #24
xjmAlso see #2347831: Fix documentation for \Drupal::url(), \Drupal::l(), etc. (and fix the change record).
Maybe we could merge those cleanups in there and set this back to fixed?
Comment #25
effulgentsia CreditAttribution: effulgentsia commentedYep, that makes sense. Done in #2347831-7: Fix documentation for \Drupal::url(), \Drupal::l(), etc. (and fix the change record).
Comment #26
jhodgdonThe change notice attached to this issue says that l() and url() deprecated. But they are actually gone. The change notice does not say they are removed or renamed. Please fix ASAP!
Comment #27
xjmI changed the word "deprecated" to "removed" in the CR title.... it already says: