You are here

private function UcAddressesUcCountryFieldHandler::getCountry in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 handlers/ubercart.handlers.inc \UcAddressesUcCountryFieldHandler::getCountry()

Returns country data.

Parameters

int $country_id: The country to get.

Return value

object Data of country if the country is found. NULL otherwise.

1 call to UcAddressesUcCountryFieldHandler::getCountry()
UcAddressesUcCountryFieldHandler::outputValue in handlers/ubercart.handlers.inc
Overrides UcAddressesFieldHandler::outputValue().

File

handlers/ubercart.handlers.inc, line 534
Field handlers for Ubercart core address fields: first_name, last_name, company, etc.

Class

UcAddressesUcCountryFieldHandler
Class for the Ubercart country field.

Code

private function getCountry($country_id) {
  if (isset(self::$countries[$country_id])) {
    return self::$countries[$country_id];
  }
  $result = db_select('uc_countries')
    ->fields('uc_countries')
    ->condition('country_id', $country_id)
    ->execute();
  $country = $result
    ->fetch();
  if ($country) {
    self::$countries[$country->country_id] = $country;
    return $country;
  }
  return NULL;
}