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.
Since #1875086: Improve DX of drupal_container()->get() using drupal_container() is depcrecated.
Comment | File | Size | Author |
---|---|---|---|
#9 | drupal-1938030-9.patch | 46.38 KB | dawehner |
#9 | interdiff.txt | 472 bytes | dawehner |
#7 | drupal-1938030-7.patch | 46.21 KB | dawehner |
#7 | interdiff.txt | 1.19 KB | dawehner |
#4 | interdiff.txt | 812 bytes | dawehner |
Comments
Comment #1
dawehnerHere is a patch that converts all services defined by views.
Comment #2
dawehnerLet's introduce a Views helper object, similar to Drupal, which does what we need.
I choosed to have one method for all plugin types, because 10 methods just one for each plugin type causes other issues:
Opened a follow up to inject all the plugin managers (as all of them are needed at one point) into the view executable.
#1938058: Inject all plugin managers to the view executable object.
Comment #3
Crell CreditAttribution: Crell commentedThis looks a bit off. Shouldn't it be Views::viewsData()->get()?
Do any of these services have a subclass, or are they all ViewsPluginManager? If subclasses, then it may make sense to give them their own utility wrappers.
At least until Views is fully injected and this class goes away. :-)
Comment #4
dawehnerRegarding the first point: you are absolute right about that!
Regarding the second point: They all do indeed have the same class, see the bundle,
though there are issues which creates custom ones for certain needs, but yeah then we can use them.
Comment #5
damiankloip CreditAttribution: damiankloip commentedPatch is looking awesome, a views wrapper is nice idea too. Just a couple of the obligatory nitpicks :
Just a space after the docblock here.
'a' or 'the'? We are only going to have one.
'Return the views analyzer service'?
same, should we use 'the' instead of 'a'?
Stuff like this looks soooo much nicer! :)
Comment #6
tim.plunkettClarifying for the meta #1938334: META: Replace uses of drupal_container()
Comment #7
dawehnerGood points damian. I really like "the" better here.
Comment #9
dawehnerOne single Views was forgot to be used :(
Comment #10
damiankloip CreditAttribution: damiankloip commentedNice clean up.
Comment #11
Dries CreditAttribution: Dries commentedCommitted to 8.x. Thanks.