Problem/Motivation
Part of #1577902: [META] Remove all usages of drupal_static() & drupal_static_reset() effort. Removes drupal_static() from views_ui_contextual_links_suppress().
Proposed resolution
- Deprecate
views_ui_contextual_links_suppress(),views_ui_contextual_links_suppress_push(),views_ui_contextual_links_suppress_pop()with no replacement.
Remaining tasks
None.
User interface changes
None.
API changes
- views_ui_contextual_links_suppress
- views_ui_contextual_links_suppress_push
- views_ui_contextual_links_suppress_pop
Have been deprecated with no replacement.
Data model changes
None.
Release notes snippet
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | interdiff_7-13.txt | 9.47 KB | alex_optim |
| #14 | 3039248-13.patch | 7.18 KB | alex_optim |
Issue fork drupal-3039248
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 #2
claudiu.cristeaPatch.
Comment #3
andypostBtw layout builder also using to suppress contextual, so makes sense to have common approach #3028191: When using Layout Builder, remove contextual links for blocks outside of the current layout
Comment #6
naresh_bavaskar#2 Patch Re-rolled for 9.1.x
Please review
Comment #7
hardik_patel_12 commentedChanging deprecation message from Drupal 8.8.0 and will be removed before Drupal 9.0.0 to Drupal 9.1.0 and will be removed before Drupal 10.0.0.
Comment #10
longwaveI am not convinced this code even works. The comment says
but if I edit the frontpage view that comes with core, contextual links are still displayed in the preview of any teaser nodes.
I put a breakpoint inside views_ui_contextual_links_suppress() and the push and pop methods are called but views_ui_contextual_links_view_alter() doesn't seem to get called in this context, although it seems like it should because the contextual links are being generated!
Comment #12
alex_optimPlease check.
Comment #13
andypost9.4.0 instead of 9.1
Comment #14
alex_optimComment #15
andypostThank you, now only deprecation test is needed
@alex_optim Do not forget to add interdiff https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupa...
Comment #16
andypostComment #17
alex_optimAdded interdiff.
Comment #19
andypostshould be 10.0.0 and 10.1.0
Comment #23
claudiu.cristeaComment #26
longwaveAs far as I can see I don't think any of this code works.
I put breakpoints in:
The push and pop are called, but the hook is never invoked. This is because contextual links don't appear to use the
#contextual_linksrender element any more, but#contextual_links_placeholderinstead - adding a breakpoint inContextualLinksPlaceholder::preRenderPlaceholder()is caught, but that doesn't invoke the alter hook.Even if this did work, the push and pop are wrapped around the preview time, which only builds a render array; the prerender hook won't be called until later, after the suppression has been popped.
I think we should deprecate these functions entirely, removing all functionality and leaving just stubs that can be removed in a future major.
Comment #29
longwaveComment #31
nicxvan commentedI searched contrib and only found one call to views_ui_contextual_links_suppress: https://www.drupal.org/project/commerce_invoice_receipt which has no current release.
I think on that alone we can deprecate with no replacement.
I did put breakpoints I saw that contextualLinksViewAlter did get called in the ui, but supress never returned true so we only hit the elseif clause.
I think that is what you are saying is right though.
This is meant to stop contextual links from showing up in the views preview right? When I checked that I do see contextual links in the preview both on this MR and in main so I think this is fine to remove.
Comment #32
nicxvan commentedTook a quick look, I think we also need a deprecation in bootstrap.inc for the drupal_static call for
views_ui_contextual_links_suppressComment #33
berdir> Took a quick look, I think we also need a deprecation in bootstrap.inc for the drupal_static call for views_ui_contextual_links_suppress
Do we really need to bother with this? This isn't a cache, it's just a means to carry in-memory-state between multiple functions, nothing anyone should ever need to reset. I'd say skip this, avoids conflicts in there.
Comment #34
nicxvan commentedI'll defer to you guys here
Comment #35
nicxvan commentedComment #36
nicxvan commentedI checked the CR and updated the IS.
I think deprecating these for removal in 12 is fine since contrib doesn't call them and they have not worked in ages.
Comment #37
alexpottCommitted and pushed 3742821e2b1 to main and 4b473042d6c to 11.x. Thanks!