Commit c9d22bc4 authored by catch's avatar catch
Browse files

Issue #2061921 by sergeypavlenko, m1r1k, alweb: Remove calls to deprecated...

Issue #2061921 by sergeypavlenko, m1r1k, alweb: Remove calls to deprecated global $user in views module.
parent 56386c3f
......@@ -269,8 +269,6 @@ public function restoreHeaders() {
* The generated cache ID.
*/
public function generateResultsKey() {
global $user;
if (!isset($this->resultsKey)) {
$build_info = $this->view->build_info;
......@@ -283,6 +281,7 @@ public function generateResultsKey() {
$build_info[$index] = (string)$query;
}
}
$user = \Drupal::currentUser();
$key_data = array(
'build_info' => $build_info,
'roles' => $user->getRoles(),
......@@ -310,8 +309,8 @@ public function generateResultsKey() {
* The generated cache ID.
*/
public function generateOutputKey() {
global $user;
if (!isset($this->outputKey)) {
$user = \Drupal::currentUser();
$key_data = array(
'result' => $this->view->result,
'roles' => $user->getRoles(),
......
......@@ -2541,8 +2541,7 @@ public function renderArea($area, $empty = FALSE) {
*/
public function access($account = NULL) {
if (!isset($account)) {
global $user;
$account = $user;
$account = \Drupal::currentUser();
}
// Full override.
......
......@@ -1359,7 +1359,7 @@ public function storeExposedInput($input, $status) {
}
// Check if we store exposed value for current user.
global $user;
$user = \Drupal::currentUser();
$allowed_rids = empty($this->options['expose']['remember_roles']) ? array() : array_filter($this->options['expose']['remember_roles']);
$intersect_rids = array_intersect(array_keys($allowed_rids), $user->getRoles());
if (empty($intersect_rids)) {
......
......@@ -1550,7 +1550,7 @@ public function access($displays = NULL, $account = NULL) {
}
if (!$account) {
$account = $GLOBALS['user'];
$account = \Drupal::currentUser();
}
// We can't use choose_display() here because that function
......
Markdown is supported
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