You are here

function country_load in Countries 8

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

19 calls to country_load()
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.
CountriesElementUnitTest::setUp in tests/countries.test

... See full list

File

./countries.module, line 293
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);
}