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 views 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())
This task a part of #2001206: Replace drupal_container() with Drupal::service()
Comment | File | Size | Author |
---|---|---|---|
#13 | views-2014043-13.patch | 4.74 KB | kgoel |
#10 | views-2014043-10.patch | 7.8 KB | kgoel |
#6 | views-2014043-6.patch | 5.26 KB | kgoel |
#3 | views-2014043-3.patch | 5.72 KB | kgoel |
#1 | views_replace_drupal_container-2014043-1.patch | 5.71 KB | nathangervais |
Comments
Comment #1
nathangervais CreditAttribution: nathangervais commentedHere's a patch to replace all occurances of drupal_container() with Drupal::service() equivalents in the views module.
Comment #3
kgoel CreditAttribution: kgoel commentedComment #4
kgoel CreditAttribution: kgoel commentedComment #5
ddrozdik CreditAttribution: ddrozdik commentedComment #6
kgoel CreditAttribution: kgoel commentedComment #8
kgoel CreditAttribution: kgoel commented#6: views-2014043-6.patch queued for re-testing.
Comment #9
dawehnerComment #10
kgoel CreditAttribution: kgoel commentedComment #11
kgoel CreditAttribution: kgoel commentedremoved tag
Comment #12
dawehnerWe removed that callback in the meantime, so it should not be added again (it is now a proper controller, so we don't need the Drupal:: conversion anymore.)
Comment #13
kgoel CreditAttribution: kgoel commentedComment #14
dawehnerI am wondering whether it actually makes more sense to try to either inject the request or refactor code, so it does not rely on the current request directly.
Comment #15
dawehnerI agree that injection is too complex for now, so let's better get rid of drupal_container() for now.
Comment #16
catchCommitted/pushed to 8.x, thanks!