function shortcutperrole_shortcut_default_set in Shortcut per Role 8
Implements hook_shortcut_default_set()
File
- ./
shortcutperrole.module, line 34 - Allows users to manage customizable lists of shortcut links.
Code
function shortcutperrole_shortcut_default_set($account) {
//determine the highest rid of user & assign the shortcut set.
$all_roles = user_roles();
$user_roles = array_flip($account
->getRoles());
$sorted_roles = array_intersect_key($all_roles, $user_roles);
if ($sorted_roles) {
$role = end($sorted_roles);
$config = \Drupal::config('shortcutperrole.settings');
$set = $config
->get('role.' . $role
->id());
}
$ss = isset($set) ? $set : SHORTCUT_PER_ROLE_DEFAULT_SET;
return $ss;
}