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.
drupal_container() is deprecated, and all calls in the layout module need to be replaced with Drupal::service(), except for where the module_handler service is requested, which needs to be replaced with Drupal::moduleHandler() (see #1957154: Replace calls to drupal_container()->get('module_handler') service with Drupal::moduleHandler())
Comment | File | Size | Author |
---|---|---|---|
#16 | layout-2011094-16.patch | 3.72 KB | kgoel |
#16 | interdiff.txt | 1.75 KB | kgoel |
#12 | layout-2011094-12.patch | 1.97 KB | kgoel |
#12 | interdiff.txt | 1.96 KB | kgoel |
#9 | layout-2011094-9.patch | 1.14 KB | kgoel |
Comments
Comment #1
kgoel CreditAttribution: kgoel commentedComment #2
kgoel CreditAttribution: kgoel commentedComment #4
ddrozdik CreditAttribution: ddrozdik commentedThis is incorrect way, just use Drupal::service('plugin.manager.layout'); in this case
Also incorrect using, should be: \Drupal::moduleHandler()->getModuleList()
In this part the leading \ should be before calling class(I just think we loosely agreed on omitting in procedural code)
Comment #5
kgoel CreditAttribution: kgoel commentedComment #7
kgoel CreditAttribution: kgoel commentedComment #9
kgoel CreditAttribution: kgoel commentedComment #10
ddrozdik CreditAttribution: ddrozdik commentedlooks good - RTBC
Comment #11
alexpottI'd be a fan of getting rid of this function entirely and replace calls to it with either the injected service (where possible) or
Drupal::service('plugin.manager.layout')
Should be $this->container->get('plugin.manager.layout');
Comment #12
kgoel CreditAttribution: kgoel commentedComment #14
kgoel CreditAttribution: kgoel commented#12: layout-2011094-12.patch queued for re-testing.
Comment #16
kgoel CreditAttribution: kgoel commented@alexpott -I just ran grep on layout_manager and found that this is being called in LayoutController.php. I am not sure if you meant to get rid of this code also.
./lib/Drupal/layout/Controller/LayoutController.php: * @param \Drupal\layout\Plugin\Type\LayoutManager $layout_manager
./lib/Drupal/layout/Controller/LayoutController.php: function __construct(LayoutManager $layout_manager) {
./lib/Drupal/layout/Controller/LayoutController.php: $this->layoutManager = $layout_manager;
Comment #17
ddrozdik CreditAttribution: ddrozdik commentedApplied, works good.
Comment #18
alexpottCommitted 1230f1d and pushed to 8.x. Thanks!