You are here

public static function UcAddressesAddressBook::loadAddress in Ubercart Addresses 6.2

Same name and namespace in other branches
  1. 7 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.

4 calls to UcAddressesAddressBook::loadAddress()
UcAddressesApiTestCase::testMultipleAddressBooks in tests/uc_addresses.api.test
Tests if address loading works as expected across multiple address books.
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.
uc_addresses_views_plugin_argument_address_access::validate_argument in views/uc_addresses_views_plugin_argument_address_access.inc
Validates if argument is a valid user and if the current user has access to addresses of the given user.

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;
}