function hook_shortcut_default_set
Same name in other branches
- 9 core/modules/shortcut/shortcut.api.php \hook_shortcut_default_set()
- 8.9.x core/modules/shortcut/shortcut.api.php \hook_shortcut_default_set()
- 10 core/modules/shortcut/shortcut.api.php \hook_shortcut_default_set()
- 11.x core/modules/shortcut/shortcut.api.php \hook_shortcut_default_set()
Return the name of a default shortcut set for the provided user account.
This hook allows modules to define default shortcut sets for a particular user that differ from the site-wide default (for example, a module may want to define default shortcuts on a per-role basis).
The default shortcut set is used only when the user does not have any other shortcut set explicitly assigned to them.
Note that only one default shortcut set can exist per user, so when multiple modules implement this hook, the last (i.e., highest weighted) module which returns a valid shortcut set name will prevail.
Parameters
$account: The user account whose default shortcut set is being requested.
Return value
The name of the shortcut set that this module recommends for that user, if there is one.
Related topics
2 invocations of hook_shortcut_default_set()
- shortcut_default_set in modules/
shortcut/ shortcut.module - Returns the default shortcut set for a given user account.
- shortcut_set_delete_form in modules/
shortcut/ shortcut.admin.inc - Form callback: builds the confirmation form for deleting a shortcut set.
File
-
modules/
shortcut/ shortcut.api.php, line 33
Code
function hook_shortcut_default_set($account) {
// Use a special set of default shortcuts for administrators only.
if (in_array(variable_get('user_admin_role', 0), $account->roles)) {
return variable_get('mymodule_shortcut_admin_default_set');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.