Updated: Comment #N
Problem/Motivation
Previously comment_uri() added the fragment comment-{cid} to the url so that the page jumped straight to the comment.
Comment::urlInfo() doesn't add this fragment, whilst porting Token to Drupal 8 we noticed the regression
Proposed resolution
Add the fragment back in Comment::urlInfo()
Remaining tasks
Review
Make tests pass if applicable
User interface changes
None
API changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | 2198041-24.patch | 2.02 KB | prem suthar |
| #23 | 2198041-nr-bot.txt | 1.46 KB | needs-review-queue-bot |
| #22 | 2198041-22.patch | 2.23 KB | karishmaamin |
| #20 | 2198041-nr-bot.txt | 169 bytes | needs-review-queue-bot |
| #8 | drupal-2198041-8-comment-canonical-url-fragment.patch | 1.75 KB | sweetchuck |
Comments
Comment #1
grom358 commentedHere is patch to add fragment
Comment #3
andypostThere's related issue #2113323: Rename Comment::permalink() to not be ambiguous with ::uri() & #2010202: Deprecate comment_uri()
Seems the canonical URL of comment should always have fragment, and the same time we need to get rid of
comment_uri()fragment should be added only for 'canonical', there's other routes in comment entity
Comment #8
sweetchuckComment #10
sweetchuckThe problem is that the #comment-{cid} is always added to the link options when the $rel is "canonical"
and this breaks the HAL tests.
The expected URL is
../comment/1?_format=hal_json
and the current one is
.../comment/1?_format=hal_json#comment-1
I can re-write the HAL test to except the new URL format, but I don't think this is the right solution. And it may causes side effects, such as break the caching.
How can I decide that when to add the "fragment" and when not to?
I change the issue status to "Needs review" because I need help.
Is it a good approach to check that the "_format" key is not exists in the queryString or exists but not equal to "html"?
Comment #13
andypostComment #20
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #21
larowlanComment #22
karishmaamin commentedRe-rolled #8 patch against 10.1.x. Please review
Comment #23
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #24
prem suthar commentedTry To Fix the #22 Custom Cmd Failed Patch.