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.
API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Url.php/c...
When you look at the class docs for Url, it hardly tell you anything. Developers reading this should be told that Url objects should be created with one of the static createFromFoo() methods, and it should give a brief list of these.
Comment | File | Size | Author |
---|---|---|---|
#18 | 3063694-10.patch | 698 bytes | Swapnil_Kotwal |
#8 | 3063694-8.patch | 633 bytes | dhirendra.mishra |
#8 | interdiff_3-8.txt | 778 bytes | dhirendra.mishra |
Comments
Comment #3
devoidfury CreditAttribution: devoidfury as a volunteer and at Mobomo commentedAdded to the comment there to point developers towards those static methods, and added a See Also entry for EntityBase::toUrl.
Comment #4
devoidfury CreditAttribution: devoidfury as a volunteer and at Mobomo commentedComment #5
joachim CreditAttribution: joachim as a volunteer commentedLooks good, but method names in docs need the () to be made into links on the API site I think.
The @see to the entity method is a nice touch!
Comment #6
dhirendra.mishra CreditAttribution: dhirendra.mishra at Valuebound for Valuebound commentedComment #7
dhirendra.mishra CreditAttribution: dhirendra.mishra at Valuebound for Valuebound commentedComment #8
dhirendra.mishra CreditAttribution: dhirendra.mishra at Valuebound for Valuebound commentedPls consider this one.
Comment #9
joachim CreditAttribution: joachim as a volunteer commentedLooks good! Thanks!
Comment #11
xjmSo I thought that I'd fixed this documentation gap, like... five years ago. Turns out, the improvements never got committed because they were tied up in an API addition: #2417459: Provide internal API for special schemes and thin public wrappers for user input and non-routed URLs
Here's the docblock that was being added there:
Can we verify that's all correct information still, and include whatever of it is accurate in the patch here? Edit: the
fromBaseRelativePath()
andfromHostRelativePath()
methods don't exist in HEAD, but the rest presumably still do.As a followup, we should perhaps create a "URL generation" API topic, or perhaps add to the routing topic and make it "Routing and URL generation".
As a docs improvement, this is eligible for backport to the production branch. Thanks!
Comment #13
xjmErr, so I apparently forgot that I'd committed this locally before pushing a different commit. Rather than reverting it, though, let's iterate on it based on #11. Usually I would either revert or ask for a new issue, but the current version is adding information that's better than the nothing that was there in HEAD... so let's continue to work on this in this issue on top of the previous commit. Thanks!
Comment #17
xjmMight as well make the branches consistent for less confusion while I'm at it.
Comment #18
Swapnil_Kotwal CreditAttribution: Swapnil_Kotwal at Asentech LLC commentedI have applied the patch. Kindly review the patch
Comment #19
rajandro CreditAttribution: rajandro as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedSet to NR to trigger the test.
Comment #23
quietone CreditAttribution: quietone at PreviousNext commentedI created two followups, one for the question in #11 #3269790: Improve class doc of core/lib/Drupal/Core/Url.php and the other is the followup requested in #11, #3269789: Add URL generation API topic. I made one for the question so that it can be handled on it's own, without code changes. It just keeps things simple.
That is everything to do here.
Comment #24
dwwFrom my reading of the issue history, the original fix was already committed and pushed. The necessary follow-ups now exist (thanks @quietone!). So I believe this is safe to call "fixed".