You are here

public function ShortcutSetStorage::unassignUser in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/shortcut/src/ShortcutSetStorage.php \Drupal\shortcut\ShortcutSetStorage::unassignUser()
  2. 9 core/modules/shortcut/src/ShortcutSetStorage.php \Drupal\shortcut\ShortcutSetStorage::unassignUser()

Unassigns a user from any shortcut set they may have been assigned to.

The user will go back to using whatever default set applies.

Parameters

$account: A user account that will be removed from the shortcut set assignment.

Return value

bool TRUE if the user was previously assigned to a shortcut set and has been successfully removed from it. FALSE if the user was already not assigned to any set.

Overrides ShortcutSetStorageInterface::unassignUser

File

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

Class

ShortcutSetStorage
Defines a storage for shortcut_set entities.

Namespace

Drupal\shortcut

Code

public function unassignUser($account) {
  $deleted = $this->connection
    ->delete('shortcut_set_users')
    ->condition('uid', $account
    ->id())
    ->execute();
  return (bool) $deleted;
}