You are here

public static function UcAddressesAddressBook::loadAddress in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 class/UcAddressesAddressBook.class.php \UcAddressesAddressBook::loadAddress()

Looks up a single address.

This method will first look in all the loaded address books if the address is already known. It it is known, then it will return the found address.

If not, it will lookup the address in the database. An UcAddressesAddress object will be created, populated with the loaded values. The address will be added to the user's address book.

@access public @static

@todo Think of a better name for this method.

Parameters

int $aid: ID of the address to load.

Return value

UcAddressesAddress An instance of UcAddressesAddress if the address was found. FALSE otherwise.

6 calls to UcAddressesAddressBook::loadAddress()
FeedsUcAddressesProcessor::entityLoad in feeds/FeedsUcAddressesProcessor.inc
Loads an existing address.
UcAddressesApiTestCase::testMultipleAddressBooks in tests/uc_addresses.api.test
Tests if address loading works as expected across multiple address books.
UcAddressesEntityController::load in class/uc_addresses.entity.inc
Implements DrupalEntityControllerInterface::load().
uc_addresses_check_access_by_ids in ./uc_addresses.module
Checks address access by ID's.
uc_addresses_handler_filter_access::loadAddress in views/uc_addresses_handler_filter_access.inc
Loads a single address.

... See full list

File

class/UcAddressesAddressBook.class.php, line 185
Contains the UcAddressesAddressBook class.

Class

UcAddressesAddressBook
The address book class

Code

public static function loadAddress($aid) {
  self::loadStatic($aid);

  // Look for the address in one of the available address books.
  foreach (self::$singleton as $addressbook) {
    if ($addressbook
      ->addressExists($aid)) {
      return $addressbook
        ->getAddressById($aid);
    }
  }
  return FALSE;
}