You are here

interface WishlistProviderInterface in Commerce Wishlist 8.3

Creates and loads wishlists for anonymous and authenticated users.

Hierarchy

Expanded class hierarchy of WishlistProviderInterface

All classes that implement WishlistProviderInterface

See also

\Drupal\commerce_wishlist\WishlistSessionInterface

5 files declare their use of WishlistProviderInterface
MoveToWishlist.php in src/Plugin/views/field/MoveToWishlist.php
WishlistBlock.php in src/Plugin/Block/WishlistBlock.php
WishlistCacheContext.php in src/Cache/Context/WishlistCacheContext.php
WishlistCacheContextTest.php in tests/src/Unit/WishlistCacheContextTest.php
WishlistController.php in src/Controller/WishlistController.php

File

src/WishlistProviderInterface.php, line 12

Namespace

Drupal\commerce_wishlist
View source
interface WishlistProviderInterface {

  /**
   * Creates a wishlist entity for the given user.
   *
   * @param string $wishlist_type
   *   The wishlist type ID.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user. If empty, the current user is assumed.
   * @param string $name
   *   The wishlist name. Defaults to t('Wishlist').
   *
   * @return \Drupal\commerce_wishlist\Entity\WishlistInterface
   *   The created wishlist entity.
   *
   * @throws \Drupal\commerce_wishlist\Exception\DuplicateWishlistException
   *   When a wishlist with the given criteria already exists.
   */
  public function createWishlist($wishlist_type, AccountInterface $account = NULL, $name = NULL);

  /**
   * Gets the wishlist entity for the given user.
   *
   * @param string $wishlist_type
   *   The wishlist type ID.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user. If empty, the current user is assumed.
   *
   * @return \Drupal\commerce_wishlist\Entity\WishlistInterface|null
   *   The wishlist entity, or NULL if none found.
   */
  public function getWishlist($wishlist_type, AccountInterface $account = NULL);

  /**
   * Gets the wishlist entity ID for the given user.
   *
   * @param string $wishlist_type
   *   The wishlist type ID.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user. If empty, the current user is assumed.
   *
   * @return int|null
   *   The wishlist entity ID, or NULL if none found.
   */
  public function getWishlistId($wishlist_type, AccountInterface $account = NULL);

  /**
   * Gets all wishlist entities for the given user.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user. If empty, the current user is assumed.
   *
   * @return \Drupal\commerce_wishlist\Entity\WishlistInterface[]
   *   A list of wishlist entities.
   */
  public function getWishlists(AccountInterface $account = NULL);

  /**
   * Gets all wishlist entity ids for the given user.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user. If empty, the current user is assumed.
   *
   * @return int[]
   *   A list of wishlist entity ids.
   */
  public function getWishlistIds(AccountInterface $account = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
WishlistProviderInterface::createWishlist public function Creates a wishlist entity for the given user. 1
WishlistProviderInterface::getWishlist public function Gets the wishlist entity for the given user. 1
WishlistProviderInterface::getWishlistId public function Gets the wishlist entity ID for the given user. 1
WishlistProviderInterface::getWishlistIds public function Gets all wishlist entity ids for the given user. 1
WishlistProviderInterface::getWishlists public function Gets all wishlist entities for the given user. 1