interface ShortcutSetStorageInterface

Same name and namespace in other branches
  1. 11.x core/modules/shortcut/src/ShortcutSetStorageInterface.php \Drupal\shortcut\ShortcutSetStorageInterface
  2. 9 core/modules/shortcut/src/ShortcutSetStorageInterface.php \Drupal\shortcut\ShortcutSetStorageInterface
  3. 8.9.x core/modules/shortcut/src/ShortcutSetStorageInterface.php \Drupal\shortcut\ShortcutSetStorageInterface

Defines an interface for shortcut_set entity storage classes.

Hierarchy

Expanded class hierarchy of ShortcutSetStorageInterface

All classes that implement ShortcutSetStorageInterface

3 files declare their use of ShortcutSetStorageInterface
ShortcutSetDeleteForm.php in core/modules/shortcut/src/Form/ShortcutSetDeleteForm.php
ShortcutSetUsers.php in core/modules/shortcut/src/Plugin/migrate/destination/ShortcutSetUsers.php
SwitchShortcutSet.php in core/modules/shortcut/src/Form/SwitchShortcutSet.php

File

core/modules/shortcut/src/ShortcutSetStorageInterface.php, line 11

Namespace

Drupal\shortcut
View source
interface ShortcutSetStorageInterface extends ConfigEntityStorageInterface {
  
  /**
   * Assigns a user to a particular shortcut set.
   *
   * @param \Drupal\shortcut\ShortcutSetInterface $shortcut_set
   *   An object representing the shortcut set.
   * @param $account
   *   A user account that will be assigned to use the set.
   */
  public function assignUser(ShortcutSetInterface $shortcut_set, $account);
  
  /**
   * Un-assigns a user from any shortcut set they may have been assigned to.
   *
   * The user will go back to using whatever default set applies.
   *
   * @param $account
   *   A user account that will be removed from the shortcut set assignment.
   *
   * @return 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.
   */
  public function unassignUser($account);
  
  /**
   * Delete shortcut sets assigned to users.
   *
   * @param \Drupal\shortcut\ShortcutSetInterface $entity
   *   Delete the user assigned sets belonging to this shortcut.
   */
  public function deleteAssignedShortcutSets(ShortcutSetInterface $entity);
  
  /**
   * Get the name of the set assigned to this user.
   *
   * @param \Drupal\user\Entity\User $account
   *   The user account.
   *
   * @return string
   *   The name of the shortcut set assigned to this user.
   */
  public function getAssignedToUser($account);
  
  /**
   * Gets the shortcut set to be displayed for a given user account.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user account whose default shortcut set will be returned.
   *
   * @return \Drupal\shortcut\ShortcutSetInterface
   *   An object representing the default shortcut set.
   */
  public function getDisplayedToUser(AccountInterface $account) : ShortcutSetInterface;
  
  /**
   * Get the number of users who have this set assigned to them.
   *
   * @param \Drupal\shortcut\ShortcutSetInterface $shortcut_set
   *   The shortcut to count the users assigned to.
   *
   * @return int
   *   The number of users who have this set assigned to them.
   */
  public function countAssignedUsers(ShortcutSetInterface $shortcut_set);
  
  /**
   * Gets the default shortcut set for a given user account.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user account whose default shortcut set will be returned.
   *
   * @return \Drupal\shortcut\ShortcutSetInterface
   *   An object representing the default shortcut set.
   */
  public function getDefaultSet(AccountInterface $account);

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.