Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / shortcut / src / ShortcutSetStorageInterface.php
1 <?php
2
3 namespace Drupal\shortcut;
4
5 use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
6 use Drupal\Core\Session\AccountInterface;
7
8 /**
9  * Defines an interface for shortcut_set entity storage classes.
10  */
11 interface ShortcutSetStorageInterface extends ConfigEntityStorageInterface {
12
13   /**
14    * Assigns a user to a particular shortcut set.
15    *
16    * @param \Drupal\shortcut\ShortcutSetInterface $shortcut_set
17    *   An object representing the shortcut set.
18    * @param $account
19    *   A user account that will be assigned to use the set.
20    */
21   public function assignUser(ShortcutSetInterface $shortcut_set, $account);
22
23   /**
24    * Unassigns a user from any shortcut set they may have been assigned to.
25    *
26    * The user will go back to using whatever default set applies.
27    *
28    * @param $account
29    *   A user account that will be removed from the shortcut set assignment.
30    *
31    * @return bool
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
34    *   to any set.
35    */
36   public function unassignUser($account);
37
38   /**
39    * Delete shortcut sets assigned to users.
40    *
41    * @param \Drupal\shortcut\ShortcutSetInterface $entity
42    *   Delete the user assigned sets belonging to this shortcut.
43    */
44   public function deleteAssignedShortcutSets(ShortcutSetInterface $entity);
45
46   /**
47    * Get the name of the set assigned to this user.
48    *
49    * @param \Drupal\user\Entity\User $account
50    *   The user account.
51    *
52    * @return string
53    *   The name of the shortcut set assigned to this user.
54    */
55   public function getAssignedToUser($account);
56
57   /**
58    * Get the number of users who have this set assigned to them.
59    *
60    * @param \Drupal\shortcut\ShortcutSetInterface $shortcut_set
61    *   The shortcut to count the users assigned to.
62    *
63    * @return int
64    *   The number of users who have this set assigned to them.
65    */
66   public function countAssignedUsers(ShortcutSetInterface $shortcut_set);
67
68   /**
69    * Gets the default shortcut set for a given user account.
70    *
71    * @param \Drupal\Core\Session\AccountInterface $account
72    *   The user account whose default shortcut set will be returned.
73    *
74    * @return \Drupal\shortcut\ShortcutSetInterface
75    *   An object representing the default shortcut set.
76    */
77   public function getDefaultSet(AccountInterface $account);
78
79 }