shortcut.api.php 1.2 KB

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