3 namespace Drupal\shortcut;
5 use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
6 use Drupal\Core\Session\AccountInterface;
9 * Defines an interface for shortcut_set entity storage classes.
11 interface ShortcutSetStorageInterface extends ConfigEntityStorageInterface {
14 * Assigns a user to a particular shortcut set.
16 * @param \Drupal\shortcut\ShortcutSetInterface $shortcut_set
17 * An object representing the shortcut set.
19 * A user account that will be assigned to use the set.
21 public function assignUser(ShortcutSetInterface $shortcut_set, $account);
24 * Unassigns a user from any shortcut set they may have been assigned to.
26 * The user will go back to using whatever default set applies.
29 * A user account that will be removed from the shortcut set assignment.
32 * TRUE if the user was previously assigned to a shortcut set and has been
33 * successfully removed from it. FALSE if the user was already not assigned
36 public function unassignUser($account);
39 * Delete shortcut sets assigned to users.
41 * @param \Drupal\shortcut\ShortcutSetInterface $entity
42 * Delete the user assigned sets belonging to this shortcut.
44 public function deleteAssignedShortcutSets(ShortcutSetInterface $entity);
47 * Get the name of the set assigned to this user.
49 * @param \Drupal\user\Entity\User $account
53 * The name of the shortcut set assigned to this user.
55 public function getAssignedToUser($account);
58 * Get the number of users who have this set assigned to them.
60 * @param \Drupal\shortcut\ShortcutSetInterface $shortcut_set
61 * The shortcut to count the users assigned to.
64 * The number of users who have this set assigned to them.
66 public function countAssignedUsers(ShortcutSetInterface $shortcut_set);
69 * Gets the default shortcut set for a given user account.
71 * @param \Drupal\Core\Session\AccountInterface $account
72 * The user account whose default shortcut set will be returned.
74 * @return \Drupal\shortcut\ShortcutSetInterface
75 * An object representing the default shortcut set.
77 public function getDefaultSet(AccountInterface $account);