function ShortcutSetStorage::getAssignedToUser

Same name and namespace in other branches
  1. 9 core/modules/shortcut/src/ShortcutSetStorage.php \Drupal\shortcut\ShortcutSetStorage::getAssignedToUser()
  2. 8.9.x core/modules/shortcut/src/ShortcutSetStorage.php \Drupal\shortcut\ShortcutSetStorage::getAssignedToUser()
  3. 11.x core/modules/shortcut/src/ShortcutSetStorage.php \Drupal\shortcut\ShortcutSetStorage::getAssignedToUser()

Get the name of the set assigned to this user.

Parameters

\Drupal\user\Entity\User $account: The user account.

Return value

string The name of the shortcut set assigned to this user.

Overrides ShortcutSetStorageInterface::getAssignedToUser

1 call to ShortcutSetStorage::getAssignedToUser()
ShortcutSetStorage::getDisplayedToUser in core/modules/shortcut/src/ShortcutSetStorage.php
Gets the shortcut set to be displayed for a given user account.

File

core/modules/shortcut/src/ShortcutSetStorage.php, line 119

Class

ShortcutSetStorage
Defines a storage for shortcut_set entities.

Namespace

Drupal\shortcut

Code

public function getAssignedToUser($account) {
  $query = $this->connection
    ->select('shortcut_set_users', 'ssu');
  $query->fields('ssu', [
    'set_name',
  ]);
  $query->condition('ssu.uid', $account->id());
  return $query->execute()
    ->fetchField();
}

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