You are here

public function ShortcutSetStorage::assignUser in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/shortcut/src/ShortcutSetStorage.php \Drupal\shortcut\ShortcutSetStorage::assignUser()

Assigns a user to a particular shortcut set.

Parameters

\Drupal\shortcut\ShortcutSetInterface $shortcut_set: An object representing the shortcut set.

$account: A user account that will be assigned to use the set.

Overrides ShortcutSetStorageInterface::assignUser

File

core/modules/shortcut/src/ShortcutSetStorage.php, line 78
Contains \Drupal\shortcut\ShortcutSetStorage.

Class

ShortcutSetStorage
Defines a storage for shortcut_set entities.

Namespace

Drupal\shortcut

Code

public function assignUser(ShortcutSetInterface $shortcut_set, $account) {
  db_merge('shortcut_set_users')
    ->key('uid', $account
    ->id())
    ->fields(array(
    'set_name' => $shortcut_set
      ->id(),
  ))
    ->execute();
  drupal_static_reset('shortcut_current_displayed_set');
}