You are here

function uc_wishlist_load in UC Wish List 8

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

Load a wish list object from the database.

Parameters

numeric $wid: The wish list ID to load; if NULL, looks for the current user's wish list.

Return value

object A wish list object.

6 calls to uc_wishlist_load()
UCWishlistAdminDeleteForm::buildForm in src/Form/UCWishlistAdminDeleteForm.php
Form constructor.
UCWishlistController::myWishlist in src/Controller/UCWishlistController.php
UCWishlistController::viewWishlist in src/Controller/UCWishlistController.php
uc_wishlist_form_alter in ./uc_wishlist.module
Implements hook_form_alter().
UserWishlistSettingsForm::buildForm in src/Form/UserWishlistSettingsForm.php
Form constructor.

... See full list

File

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

Code

function uc_wishlist_load($wid) {
  if (empty($wid)) {
    $wid = uc_wishlist_get_wid();
  }
  if (!$wid || !is_numeric($wid)) {
    return FALSE;
  }
  $wishlist_manager = \Drupal::service('uc_wishlist.manager');
  $result = $wishlist_manager
    ->getWishlist($wid);
  if ($wishlist = $result
    ->fetchObject()) {
    $wishlist->address = unserialize($wishlist->address);
    return $wishlist;
  }
}