private function SplashifyInjection::checkRole in Splashify 8.2
Check if the role of the current user pass the conditions in the group.
Parameters
$group:
Return value
bool
1 call to SplashifyInjection::checkRole()
- SplashifyInjection::getPageGroups in src/
Service/ SplashifyInjection.php - Received all of splash groups that can be displayed on the current page.
File
- src/
Service/ SplashifyInjection.php, line 239
Class
- SplashifyInjection
- Class SplashifyInjection.
Namespace
Drupal\splashify\ServiceCode
private function checkRole($group) {
// Get user account.
$account = \Drupal::currentUser()
->getAccount();
// Check whether use role setting is checked.
if ($group
->isRestrictRoles()) {
$account_roles = $account
->getRoles();
$group_roles = $group
->getRoles();
return !empty(array_intersect($account_roles, $group_roles));
}
return TRUE;
}