public function CommerceGuysMarketplaceManagerBase::load in Commerce Guys Marketplace 7
Loads an item from the remote service.
Parameters
$id: The id of the item to retrieve.
Return value
The loaded item if found, FALSE otherwise.
File
- includes/
commerceguys_marketplace.base.inc, line 48
Class
- CommerceGuysMarketplaceManagerBase
- Defines the base manager class for interacting with remote marketplace items.
Code
public function load($id) {
if (!isset($this->loadedItems[$id])) {
$item = FALSE;
$response = drupal_http_request($this->endpoint . '/' . $this->resource . '/' . $id);
$data = json_decode($response->data);
if (is_object($data)) {
$item = $data;
}
$this->loadedItems[$id] = $item;
}
return $this->loadedItems[$id];
}