Problem/Motivation
Follow up to #2476947: Convert "title" page element into a block, we had to namespace views_add_contextual_links() in ViewPageControllerTest which was a copy of the same thing done in ViewBlockTest. In both cases the function needs to exist to prevent a fatal "function does not exist" error. If there is any potential for the function to be called, we need the functionality mocked, as well.
Also replace views_add_contextual_links() in views.module with a service and update all views_add_contextual_links() instances in core .
Proposed resolution
Convert views_add_contextual_links() to service and deprecate it.
Remaining tasks
None.
User interface changes
None.
API changes
- views_add_contextual_links() is deprecated
- New service
Drupal\views\ContextualLinksHelper
Data model changes
None.
| Comment | File | Size | Author |
|---|
Issue fork drupal-2571679
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #14
narendrarComment #16
narendrarI will add the Draft CR once this MR is approved.
Comment #17
smustgrave commentedThink this could use an IS and title update. Seems to talk about page controller and block tests
Left a question on the MR
Comment #18
narendrarComment #19
narendrarComment #20
smustgrave commentedDid a quick service for views_add_contextual_links and seems they were all replaced.
Only moving to NW for the change record to announce the deprecation.
Comment #21
narendrarCR added.
Comment #22
smustgrave commentedThanks!
Comment #23
quietone commentedI'm triaging RTBC issues. I read the IS, the comments and the CR. Nice to see BC considered and requests for the IS and title to be updated. I didn't find any unanswered questions. And the CR is brief and clear.
It is good to see all the documentation added to the new service. Thanks!
However, many of the comments both the new ones and the ones copied from existing code to the service are not wrapped at 80 columns. And there are some other changes needed for coding standards. I also had trouble following the long sentences is some of the paragraphs so am hoping that can be changed to make it easier for the reader.
Setting to needs work for the comments.
Comment #25
narendrarChanges done as suggested.
Comment #26
smustgrave commentedLeft a comment on the one thread.
Comment #27
narendrarComment #28
smustgrave commentedBelieve this is ready.
Comment #29
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #31
ankithashettyResolved conflicts and rebased the MR.
Thanks!
Comment #32
smustgrave commentedReroll seems fine.
Comment #33
quietone commentedI'm triaging RTBC issues. I read the IS and the comments.
I read the MR and left comments. Since there is work to do I am changing the status. For me, the key thing is to improve the docblock for \Drupal\views\ContextualLinks::addLinks. Oh, and to add return types.
Cheers
Comment #36
berdirAdded a few comments. this has lots of conflicts with a recently committed issue and will need to be rebased.
Comment #38
claudiu.cristeaI've tried to rewrite the huge docblock but I would leave it to a native English speaker.
Comment #39
claudiu.cristeaSo far...
Ready for review
Comment #40
nicxvan commentedI really wonder about updating the doc block too much. Many times that gets pushed back, should we do a follow up?
Comment #41
claudiu.cristea@nicxvan, I think is readable now. We can keep it here
Comment #42
nicxvan commentedI read through the comment and I have one really minor suggestion.
There is also a conflict, setting it to needs work for the conflict more than my suggestion.
Let me know when is rebased and I'll look again, but I think it's ready.
Comment #43
claudiu.cristeaFixed the conflict, applied suggestion. Ready for a new round of review
Comment #44
nicxvan commentedNoticed one final issue in the comment which I self applied, it was super minor.
I rebased so I could use
git diff main --color-moved=dimmed_zebra --color-moved-ws=ignore-all-spaceRebase was clean, but the zebra diff didn't help, I forgot it was a bit more complex than a copy.
I reviewed the deprecated function and new class and the logic seems clearer in the new class.
I also pulled this down and manually tested. I think this is ready!
I think it's fine to RTBC since the rebase was clean and I just updated the comment referencing template_preprocess_views_view.
Comment #45
godotislate10 years later, this is super close! Some minor wording fixes and let's try strict types on the new service class.
Comment #46
claudiu.cristeaReady for a new review
Comment #47
nicxvan commentedAll feedback has been addressed!
Thanks!
Comment #48
amateescu commentedAdded two minor points to the MR, and closed all but one of the others that have been fixed in the meantime. Feel free to self-rtbc after addressing those :)
Comment #49
claudiu.cristeaReady for a new review
Comment #50
godotislateLatest comments addressed.
Comment #52
amateescu commentedCommitted 6429cd3 and pushed to main. Thanks!
Doesn't apply cleanly to 11.x so we'll need a new MR for it.
Comment #54
nicxvan commentedI created a backport.
Two conflicts, one in ViewsBlockTest and one for the actual deprecation in views.module.
Comment #55
nicxvan commentedComment #56
nicxvan commentedThere is an issue with the tests.
Comment #57
godotislateIn 11.x, view.services.yml doesn't have autowire: true in the defaults, so
autowire: trueneeds to be added back to ViewsConfigUpdater.Comment #58
nicxvan commentedThanks! I was jumping into a meeting so I wasn't able to look at it
Comment #59
nicxvan commentedDrupal\Tests\contextual\FunctionalJavascript\DuplicateContextualLinksis failingComment #60
claudiu.cristeaThat's random I think.
Comment #61
nicxvan commentedYep it was random, it passes locally and running it again a few times it passed.
Comment #62
claudiu.cristeaCompared the MRs. They look the same except the autowire per-service in services.yml which fixed 11.x
Comment #64
amateescu commentedCommitted d05c9c0 and pushed to 11.x. Thanks!
I have an issue open for that specific random failure, and it would be good to get some eyes on it because it fails *a lot* lately: #3583187: [random test failure] DuplicateContextualLinksTest::testSameContextualLinks