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.
See meta-issue: #2511554: [meta] Move some parts of Page Manager into CTools
Per #2511568: Create "context stack" service where available contexts can be registered a context stack is going to be added to CTools. Once it's in, we should use that and remove these classes:
- Drupal\page_manager\EventSubscriber\CurrentUserContext
- Drupal\page_manager\EventSubscriber\RouteParamContext
Comment | File | Size | Author |
---|---|---|---|
#10 | 2511596-pm-10.patch | 69.86 KB | tim.plunkett |
Comments
Comment #1
dsnopekPostponed on #2511568: Create "context stack" service where available contexts can be registered
Comment #2
dsnopekI have a feeling we could use the core "lazy context" thing at this point to eliminate these classes from Page Manager. Of course, the Ctools context stack is still a good idea, but killing this code is really the goal of this issue.
Comment #3
tim.plunkettWorking on this.
Comment #4
tim.plunkettUnfortunately we have to duplicate ALL of LazyContextRepository just to pass along a parameter.
Comment #6
tim.plunkettComment #7
tim.plunkettDidn't have enough test coverage, static contexts didn't work.
Comment #8
tim.plunkettComment #10
tim.plunkettComment #11
tim.plunkettThis is the worst class I've ever written.
Comment #12
dsnopekThis ... is not how I thought this would go. :-) Would it make more sense to keep the thing we had before, but allow it to also use the core context providers, so we could at least remove the duplicated ones? Or actually, that seems to be more-or-less what this doing, we just can't reuse the core route one. Hrm. This comment is full of nothing useful. :-/
Comment #13
neclimdulTrivial to the scope of this patch but I personally prefer providing the empty array and documenting where its populated rather then leaving it missing. Makes things more clear when reading the services file what you'd expect on the other side.
The compiler pass can also pull in the argument and merge it so it would work if someone where to write their own compiler pass and wanted to run first for what ever reason.
Edit: remove dreditor weirdness.
Comment #14
BerdirWill try to review this asap. I think it's going in the same direction as what I wrote about in #2511568: Create "context stack" service where available contexts can be registered. I need to look at this more closely, but some of the things I'm thinking about there that this probably doesn't cover yet:
* Do it in ctools, based on a generic interface
* Support multiple objects like a page manage page with their own context, by using that object as static cache instead of a property. Page manager itself already has that I think, with the page and the variant, although one is a superset of the other.
* Also take care of static contexts and relationships, in some way
Comment #15
andypostPatch seriously outdated after contexts moved to ctools
Comment #16
DamienMcKennaComment #17
andypostPatch needs work cos accepted #2633052: Page variant by current language