You are here

public function WishlistProvider::getWishlist in Commerce Wishlist 8.3

Gets the wishlist entity for the given user.

Parameters

string $wishlist_type: The wishlist type ID.

\Drupal\Core\Session\AccountInterface $account: The user. If empty, the current user is assumed.

Return value

\Drupal\commerce_wishlist\Entity\WishlistInterface|null The wishlist entity, or NULL if none found.

Overrides WishlistProviderInterface::getWishlist

File

src/WishlistProvider.php, line 125

Class

WishlistProvider
Default implementation of the wishlist provider.

Namespace

Drupal\commerce_wishlist

Code

public function getWishlist($wishlist_type, AccountInterface $account = NULL) {
  $wishlist = NULL;
  $wishlist_id = $this
    ->getWishlistId($wishlist_type, $account);
  if ($wishlist_id) {
    $wishlist = $this->wishlistStorage
      ->load($wishlist_id);
  }
  return $wishlist;
}