You are here

function uc_wishlist_get_wid in UC Wish List 8

Same name and namespace in other branches
  1. 6 uc_wishlist.module \uc_wishlist_get_wid()
  2. 7 uc_wishlist.module \uc_wishlist_get_wid()

Return the wish list ID of the specified user (defaults to current user).

7 calls to uc_wishlist_get_wid()
UCWishlistController::myWishlist in src/Controller/UCWishlistController.php
UCWishlistController::viewWishlist in src/Controller/UCWishlistController.php
uc_product_update_wishlist_item in ./uc_wishlist.module
Update information about a specific item in current wish list.
uc_wishlist_add_item in ./uc_wishlist.module
Adds an item to a user's wish list.
uc_wishlist_form_alter in ./uc_wishlist.module
Implements hook_form_alter().

... See full list

File

./uc_wishlist.module, line 438
Allows users to create public shopping/wish lists.

Code

function uc_wishlist_get_wid($uid = NULL) {

  // Find the wish list matching the authenticated or anonymous user ID.
  // TODO: Handle multiple wishlists?
  if (empty($uid)) {

    // uc_wishlist_get_uid();
    $uid = \Drupal::currentUser()
      ->id();
  }
  $wishlist_manager = \Drupal::service('uc_wishlist.manager');
  return $wishlist_manager
    ->getWishlistIdByUser($uid);
}