function shortcut_default_set

Returns the default shortcut set for a given user account.


object $account: (optional) The user account whose default shortcut set will be returned. If not provided, the function will return the currently logged-in user's default shortcut set.

Return value

An object representing the default shortcut set.

5 calls to shortcut_default_set()
ShortcutSetsTestCase::testShortcutSetUnassign in drupal/modules/shortcut/shortcut.test
Tests unassigning a shortcut set.
shortcut_current_displayed_set in drupal/modules/shortcut/shortcut.module
Returns the current displayed shortcut set for the provided user account.
shortcut_set_add_form_submit in drupal/modules/shortcut/
Submit handler for shortcut_set_add_form().
shortcut_set_switch in drupal/modules/shortcut/
Form callback: builds the form for switching shortcut sets.
shortcut_set_switch_submit in drupal/modules/shortcut/
Submit handler for shortcut_set_switch().


drupal/modules/shortcut/shortcut.module, line 521
Allows users to manage customizable lists of shortcut links.


function shortcut_default_set($account = NULL) {
  global $user;
  if (!isset($account)) {
    $account = $user;

  // Allow modules to return a default shortcut set name. Since we can only
  // have one, we allow the last module which returns a valid result to take
  // precedence. If no module returns a valid set, fall back on the site-wide
  // default, which is the lowest-numbered shortcut set.
  $suggestions = array_reverse(module_invoke_all('shortcut_default_set', $account));
  $suggestions[] = SHORTCUT_DEFAULT_SET_NAME;
  foreach ($suggestions as $name) {
    if ($shortcut_set = shortcut_set_load($name)) {
  return $shortcut_set;