Commit 35632544 authored by catch's avatar catch

Issue #2062211 by rych, m1r1k, joelpittet, dstorozhuk: Remove calls to...

Issue #2062211 by rych, m1r1k, joelpittet, dstorozhuk: Remove calls to deprecated global $user in system module (first part).
parent 93c57498
......@@ -1851,7 +1851,7 @@ function hook_file_download($uri) {
* shipped file.
*/
function hook_file_url_alter(&$uri) {
global $user;
$user = \Drupal::currentUser();
// User 1 will always see the local file in this example.
if ($user->id() == 1) {
......@@ -2718,8 +2718,7 @@ function hook_url_outbound_alter(&$path, &$options, $original_path) {
// Instead of pointing to user/[uid]/edit, point to user/me/edit.
if (preg_match('|^user/([0-9]*)/edit(/.*)?|', $path, $matches)) {
global $user;
if ($user->id() == $matches[1]) {
if (\Drupal::currentUser()->id() == $matches[1]) {
$path = 'user/me/edit' . $matches[2];
}
}
......
......@@ -123,8 +123,7 @@ function system_help($path, $arg) {
}
break;
case 'admin/config/development/maintenance':
global $user;
if ($user->id() == 1) {
if (\Drupal::currentUser()->id() == 1) {
return '<p>' . t('Use maintenance mode when making major updates, particularly if the updates could disrupt visitors or the update process. Examples include upgrading, importing or exporting content, modifying a theme, modifying content types, and making backups.') . '</p>';
}
break;
......@@ -2187,7 +2186,7 @@ function system_user_login($account) {
* Add the time zone field to the user edit and register forms.
*/
function system_user_timezone(&$form, &$form_state) {
global $user;
$user = \Drupal::currentUser();
$account = $form_state['controller']->getEntity();
$form['timezone'] = array(
......
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