You are here

function country_load in Countries 7.2

Same name and namespace in other branches
  1. 8 countries.module \country_load()
  2. 7 countries.module \country_load()

Loads a country entity by ISO alpha-2 code.

This is also a menu wildcard loader.

Parameters

string $iso2: An ISO alpha-2 string. This is case-insensitive.

Return value

object A country object loaded by the entity controller.

22 calls to country_load()
CountriesBaseInstallUnitTest::testCountriesAdminListing in tests/countries.test
This browes the admin listing, making sure that the countries are correctly listed.
CountriesCacheUnitTest::testCache in tests/countries.test
CountriesCRUDUIUnitTest::testCountriesAddition in tests/countries.test
This test that the country property lookup is working.
CountriesCRUDUIUnitTest::testISO2Conflict in tests/countries.test
Special case where the ISO matches an existing ISO code.
CountriesCRUDUnitTest::testCountriesCRUD in tests/countries.test
This test that the country property lookup is working.

... See full list

File

./countries.module, line 286
Defines the field and entity information for countries.

Code

function country_load($iso2) {

  // The URL's should be case insensitive.
  $iso2 = $iso2 ? drupal_strtoupper($iso2) : $iso2;
  return entity_load_single('country', $iso2);
}