Mercurial > hg > rr-repo
annotate modules/shortcut/shortcut.api.php @ 0:ff03f76ab3fe
initial version
author | danieleb <danielebarchiesi@me.com> |
---|---|
date | Wed, 21 Aug 2013 18:51:11 +0100 |
parents | |
children |
rev | line source |
---|---|
danielebarchiesi@0 | 1 <?php |
danielebarchiesi@0 | 2 |
danielebarchiesi@0 | 3 /** |
danielebarchiesi@0 | 4 * @file |
danielebarchiesi@0 | 5 * Hooks provided by the Shortcut module. |
danielebarchiesi@0 | 6 */ |
danielebarchiesi@0 | 7 |
danielebarchiesi@0 | 8 /** |
danielebarchiesi@0 | 9 * @addtogroup hooks |
danielebarchiesi@0 | 10 * @{ |
danielebarchiesi@0 | 11 */ |
danielebarchiesi@0 | 12 |
danielebarchiesi@0 | 13 /** |
danielebarchiesi@0 | 14 * Return the name of a default shortcut set for the provided user account. |
danielebarchiesi@0 | 15 * |
danielebarchiesi@0 | 16 * This hook allows modules to define default shortcut sets for a particular |
danielebarchiesi@0 | 17 * user that differ from the site-wide default (for example, a module may want |
danielebarchiesi@0 | 18 * to define default shortcuts on a per-role basis). |
danielebarchiesi@0 | 19 * |
danielebarchiesi@0 | 20 * The default shortcut set is used only when the user does not have any other |
danielebarchiesi@0 | 21 * shortcut set explicitly assigned to them. |
danielebarchiesi@0 | 22 * |
danielebarchiesi@0 | 23 * Note that only one default shortcut set can exist per user, so when multiple |
danielebarchiesi@0 | 24 * modules implement this hook, the last (i.e., highest weighted) module which |
danielebarchiesi@0 | 25 * returns a valid shortcut set name will prevail. |
danielebarchiesi@0 | 26 * |
danielebarchiesi@0 | 27 * @param $account |
danielebarchiesi@0 | 28 * The user account whose default shortcut set is being requested. |
danielebarchiesi@0 | 29 * @return |
danielebarchiesi@0 | 30 * The name of the shortcut set that this module recommends for that user, if |
danielebarchiesi@0 | 31 * there is one. |
danielebarchiesi@0 | 32 */ |
danielebarchiesi@0 | 33 function hook_shortcut_default_set($account) { |
danielebarchiesi@0 | 34 // Use a special set of default shortcuts for administrators only. |
danielebarchiesi@0 | 35 if (in_array(variable_get('user_admin_role', 0), $account->roles)) { |
danielebarchiesi@0 | 36 return variable_get('mymodule_shortcut_admin_default_set'); |
danielebarchiesi@0 | 37 } |
danielebarchiesi@0 | 38 } |
danielebarchiesi@0 | 39 |
danielebarchiesi@0 | 40 /** |
danielebarchiesi@0 | 41 * @} End of "addtogroup hooks". |
danielebarchiesi@0 | 42 */ |