function user_template_preprocess_default_variables_alter
user_template_preprocess_default_variables_alter(&$variables)
Implements hook_template_preprocess_default_variables_alter().
See also
File
- core/modules/user/user.module, line 433
- Enables the user registration and login system.
Code
function user_template_preprocess_default_variables_alter(&$variables) { $user = \Drupal::currentUser(); $variables['user'] = clone $user; // Remove password and session IDs, since themes should not need nor see them. unset($variables['user']->pass, $variables['user']->sid, $variables['user']->ssid); $variables['is_admin'] = $user->hasPermission('access administration pages'); $variables['logged_in'] = $user->isAuthenticated(); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!user!user.module/function/user_template_preprocess_default_variables_alter/8.1.x