Following [#2032447] it is possible to remove (nearly) all calls to the deprecated global user object and replace them with "$user = \Drupal::request()->attributes->get('account');"

This issue in tracker module is the first child of this META issue: #2047951: [META] Remove calls to deprecated global $user and $GLOBALS['user'].

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stevector’s picture

Status: Active » Needs review
FileSize
653 bytes
Crell’s picture

1) We may want to change the name of the parameter to the function to avoid confusion.

2) user_access() is now deprecated as well. How many kittens die if we also change that to $account->hasPermission('access content')?

stevector’s picture

@Crell

1) "$account_to_check" ?

2) Five kittens. I didn't know about that deprecation. Is there a change notice? I can't find one. A separate META issue? I'm fine changing it in this issue so long as I can link to a justification.

Crell’s picture

m1r1k’s picture

Assigned: Unassigned » m1r1k
FileSize
895 bytes

Here is a patch:

Crell’s picture

Status: Needs review » Reviewed & tested by the community

Spiffy.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Adding link to META issue.