You are here

public function WishlistProvider::getWishlists in Commerce Wishlist 8.3

Gets all wishlist entities for the given user.

Parameters

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

Return value

\Drupal\commerce_wishlist\Entity\WishlistInterface[] A list of wishlist entities.

Overrides WishlistProviderInterface::getWishlists

File

src/WishlistProvider.php, line 154

Class

WishlistProvider
Default implementation of the wishlist provider.

Namespace

Drupal\commerce_wishlist

Code

public function getWishlists(AccountInterface $account = NULL) {
  $wishlists = [];
  $wishlist_ids = $this
    ->getWishlistIds($account);
  if ($wishlist_ids) {
    $wishlists = $this->wishlistStorage
      ->loadMultiple($wishlist_ids);
  }
  return $wishlists;
}