shortcut_default_set($account = NULL)
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
An object representing the default shortcut set.
File
- core/modules/shortcut/shortcut.module, line 202
- Allows users to manage customizable lists of shortcut links.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | function shortcut_default_set( $account = NULL) { $user = \Drupal::currentUser(); 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 (\Drupal::moduleHandler()->invokeAll( 'shortcut_default_set' , array ( $account ))); $suggestions [] = 'default' ; foreach ( $suggestions as $name ) { if ( $shortcut_set = ShortcutSet::load( $name )) { break ; } } return $shortcut_set ; } |
Please login to continue.