Commit 7dc6bbf0 authored by catch's avatar catch
Browse files

Issue #2014043 by kgoel, nathangervais: Replace drupal_container() with...

Issue #2014043 by kgoel, nathangervais: Replace drupal_container() with \Drupal in the views module.
parent 3e839344
...@@ -1741,7 +1741,7 @@ public function buildOptionsForm(&$form, &$form_state) { ...@@ -1741,7 +1741,7 @@ public function buildOptionsForm(&$form, &$form_state) {
break; break;
case 'analyze-theme': case 'analyze-theme':
$form['#title'] .= t('Theming information'); $form['#title'] .= t('Theming information');
if ($theme = drupal_container()->get('request')->request->get('theme')) { if ($theme = \Drupal::request()->request->get('theme')) {
$this->theme = $theme; $this->theme = $theme;
} }
elseif (empty($this->theme)) { elseif (empty($this->theme)) {
......
...@@ -1483,7 +1483,7 @@ public function getRenderTokens($item) { ...@@ -1483,7 +1483,7 @@ public function getRenderTokens($item) {
} }
// Get flattened set of tokens for any array depth in $_GET parameters. // Get flattened set of tokens for any array depth in $_GET parameters.
$tokens += $this->getTokenValuesRecursive(drupal_container()->get('request')->query->all()); $tokens += $this->getTokenValuesRecursive(\Drupal::request()->query->all());
// Now add replacements for our fields. // Now add replacements for our fields.
foreach ($this->view->display_handler->getHandlers('field') as $field => $handler) { foreach ($this->view->display_handler->getHandlers('field') as $field => $handler) {
......
...@@ -211,7 +211,7 @@ public function validateOptionsForm(&$form, &$form_state) { ...@@ -211,7 +211,7 @@ public function validateOptionsForm(&$form, &$form_state) {
public function query() { public function query() {
if ($this->itemsPerPageExposed()) { if ($this->itemsPerPageExposed()) {
$query = drupal_container()->get('request')->query; $query = \Drupal::request()->query;
$items_per_page = $query->get('items_per_page'); $items_per_page = $query->get('items_per_page');
if ($items_per_page > 0) { if ($items_per_page > 0) {
$this->options['items_per_page'] = $items_per_page; $this->options['items_per_page'] = $items_per_page;
...@@ -221,7 +221,7 @@ public function query() { ...@@ -221,7 +221,7 @@ public function query() {
} }
} }
if ($this->isOffsetExposed()) { if ($this->isOffsetExposed()) {
$query = drupal_container()->get('request')->query; $query = \Drupal::request()->query;
$offset = $query->get('offset'); $offset = $query->get('offset');
if (isset($offset) && $offset >= 0) { if (isset($offset) && $offset >= 0) {
$this->options['offset'] = $offset; $this->options['offset'] = $offset;
...@@ -265,7 +265,7 @@ public function setCurrentPage($number = NULL) { ...@@ -265,7 +265,7 @@ public function setCurrentPage($number = NULL) {
// Fill in missing values in the global page array, in case the global page // Fill in missing values in the global page array, in case the global page
// array hasn't been initialized before. // array hasn't been initialized before.
$page = drupal_container()->get('request')->query->get('page'); $page = \Drupal::request()->query->get('page');
$page = isset($page) ? explode(',', $page) : array(); $page = isset($page) ? explode(',', $page) : array();
for ($i = 0; $i <= $this->options['id'] || $i < count($pager_page_array); $i++) { for ($i = 0; $i <= $this->options['id'] || $i < count($pager_page_array); $i++) {
......
...@@ -84,10 +84,9 @@ public function testPluginData() { ...@@ -84,10 +84,9 @@ public function testPluginData() {
* This will iterate through all plugins from _views_fetch_plugin_data(). * This will iterate through all plugins from _views_fetch_plugin_data().
*/ */
public function testPluginInstances() { public function testPluginInstances() {
$container = drupal_container();
foreach ($this->definitions as $type => $plugins) { foreach ($this->definitions as $type => $plugins) {
// Get a plugin manager for this type. // Get a plugin manager for this type.
$manager = $container->get("plugin.manager.views.$type"); $manager = $this->container->get("plugin.manager.views.$type");
foreach ($plugins as $id => $definition) { foreach ($plugins as $id => $definition) {
// Get a reflection class for this plugin. // Get a reflection class for this plugin.
// We only want to test true plugins, i.e. They extend PluginBase. // We only want to test true plugins, i.e. They extend PluginBase.
......
...@@ -570,7 +570,7 @@ public function getExposedInput() { ...@@ -570,7 +570,7 @@ public function getExposedInput() {
// Fill our input either from $_GET or from something previously set on the // Fill our input either from $_GET or from something previously set on the
// view. // view.
if (empty($this->exposed_input)) { if (empty($this->exposed_input)) {
$this->exposed_input = drupal_container()->get('request')->query->all(); $this->exposed_input = \Drupal::request()->query->all();
// unset items that are definitely not our input: // unset items that are definitely not our input:
foreach (array('page', 'q') as $key) { foreach (array('page', 'q') as $key) {
if (isset($this->exposed_input[$key])) { if (isset($this->exposed_input[$key])) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment