You are here

public function MongodbShortcutSetStorage::getAssignedToUser in MongoDB 8

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

File

mongodb_shortcut/src/MongodbShortcutSetStorage.php, line 104
Contains \Drupal\mongodb_shortcut\MongodbShortcutSetStorage.

Class

MongodbShortcutSetStorage

Namespace

Drupal\mongodb_shortcut

Code

public function getAssignedToUser($account) {
  $set = $this->mongo
    ->get('shortcut_set_users')
    ->findOne([
    '_id' => $account
      ->id(),
  ], [
    'set_name' => 1,
  ]);
  return $set ? $set['set_name'] : FALSE;
}