function shortcut_default_set

Same name in other branches
  1. 7.x modules/shortcut/shortcut.module \shortcut_default_set()
  2. 9 core/modules/shortcut/shortcut.module \shortcut_default_set()
  3. 8.9.x core/modules/shortcut/shortcut.module \shortcut_default_set()

Returns the default shortcut set for a given user account.

Parameters

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

\Drupal\shortcut\ShortcutSetInterface|null An object representing the default shortcut set.

Deprecated

in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\shortcut\ShortcutSetStorageInterface::getDefaultSet() instead.

See also

https://www.drupal.org/node/3427050

1 string reference to 'shortcut_default_set'
ShortcutSetDeleteForm::buildForm in core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php
Form constructor.

File

core/modules/shortcut/shortcut.module, line 179

Code

function shortcut_default_set($account = NULL) {
    @trigger_error(__FUNCTION__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \\Drupal\\shortcut\\ShortcutSetStorageInterface::getDefaultSet() instead. See https://www.drupal.org/node/3427050', E_USER_DEPRECATED);
    $user = \Drupal::currentUser();
    if (!isset($account)) {
        $account = $user;
    }
    return \Drupal::entityTypeManager()->getStorage('shortcut_set')
        ->getDefaultSet($account);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.