public function WishlistProviderInterface::createWishlist in Commerce Wishlist 8.3
Creates a 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.
string $name: The wishlist name. Defaults to t('Wishlist').
Return value
\Drupal\commerce_wishlist\Entity\WishlistInterface The created wishlist entity.
Throws
\Drupal\commerce_wishlist\Exception\DuplicateWishlistException When a wishlist with the given criteria already exists.
1 method overrides WishlistProviderInterface::createWishlist()
- WishlistProvider::createWishlist in src/
WishlistProvider.php - Creates a wishlist entity for the given user.
File
- src/
WishlistProviderInterface.php, line 30
Class
- WishlistProviderInterface
- Creates and loads wishlists for anonymous and authenticated users.
Namespace
Drupal\commerce_wishlistCode
public function createWishlist($wishlist_type, AccountInterface $account = NULL, $name = NULL);