function _is_user_admin in Simplify 8
Checks if this user is a super admin, ie as the admin role or is user1.
Return value
bool TRUE is super admin or user1, FALSE otherwise.
1 call to _is_user_admin()
- simplify_hide_fields in ./
simplify.module - Hide fields from all users without the 'View hidden fields' permission.
File
- ./
simplify.module, line 660 - Hooks implemented by the simplify module.
Code
function _is_user_admin() {
$user = \Drupal::currentUser();
if ($user
->id() == 1) {
return TRUE;
}
foreach ($user
->getRoles(TRUE) as $rid) {
$role = Role::load($rid);
if ($role instanceof RoleInterface && $role
->isAdmin()) {
return TRUE;
}
}
return FALSE;
}