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.
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'].
Comment | File | Size | Author |
---|---|---|---|
#5 | tracker_module_global_user-2047935-5.patch | 895 bytes | m1r1k |
#1 | tracker_module_global_user-2047935-1.patch | 653 bytes | stevector |
Comments
Comment #1
stevectorComment #2
Crell CreditAttribution: Crell commented1) 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')?
Comment #3
stevector@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.
Comment #4
Crell CreditAttribution: Crell commented#1966334: Convert user_access to User::hasPermission()
#2048171: [meta] Replace user_access() calls with $account->hasPermission() wherever possible.
There's too many kittens in the world as is...
$user maybe?
Comment #5
m1r1k CreditAttribution: m1r1k commentedHere is a patch:
Comment #6
Crell CreditAttribution: Crell commentedSpiffy.
Comment #7
webchickCommitted and pushed to 8.x. Thanks!
Comment #8.0
(not verified) CreditAttribution: commentedAdding link to META issue.