root / drupal7 / modules / shortcut / shortcut.api.php @ master
1 |
<?php
|
---|---|
2 |
|
3 |
/**
|
4 |
* @file
|
5 |
* Hooks provided by the Shortcut module.
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* @addtogroup hooks
|
10 |
* @{
|
11 |
*/
|
12 |
|
13 |
/**
|
14 |
* Return the name of a default shortcut set for the provided user account.
|
15 |
*
|
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).
|
19 |
*
|
20 |
* The default shortcut set is used only when the user does not have any other
|
21 |
* shortcut set explicitly assigned to them.
|
22 |
*
|
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.
|
26 |
*
|
27 |
* @param $account
|
28 |
* The user account whose default shortcut set is being requested.
|
29 |
* @return
|
30 |
* The name of the shortcut set that this module recommends for that user, if
|
31 |
* there is one.
|
32 |
*/
|
33 |
function hook_shortcut_default_set($account) { |
34 |
// Use a special set of default shortcuts for administrators only.
|
35 |
if (in_array(variable_get('user_admin_role', 0), $account->roles)) { |
36 |
return variable_get('mymodule_shortcut_admin_default_set'); |
37 |
} |
38 |
} |
39 |
|
40 |
/**
|
41 |
* @} End of "addtogroup hooks".
|
42 |
*/
|