5 * Hooks provided by the Shortcut module.
14 * Return the name of a default shortcut set for the provided user account.
16 * This hook allows modules to define default shortcut sets for a particular
17 * user that differ from the site-wide default (for example, a module may want
18 * to define default shortcuts on a per-role basis).
20 * The default shortcut set is used only when the user does not have any other
21 * shortcut set explicitly assigned to them.
23 * Note that only one default shortcut set can exist per user, so when multiple
24 * modules implement this hook, the last (i.e., highest weighted) module which
25 * returns a valid shortcut set name will prevail.
28 * The user account whose default shortcut set is being requested.
30 * The name of the shortcut set that this module recommends for that user, if
33 function hook_shortcut_default_set($account) {
34 // Use a special set of default shortcuts for administrators only.
35 $roles = \Drupal::entityManager()->getStorage('user_role')->loadByProperties(['is_admin' => TRUE]);
36 $user_admin_roles = array_intersect(array_keys($roles), $account->getRoles());
37 if ($user_admin_roles) {
38 return 'admin-shortcuts';
43 * @} End of "addtogroup hooks".