function _countries_devel_generate in Countries 8
Same name and namespace in other branches
- 7.2 countries.devel_generate.inc \_countries_devel_generate()
Implements hook_devel_generate().
1 call to _countries_devel_generate()
- countries_devel_generate in ./
countries.devel_generate.inc - Implements hook_devel_generate().
1 string reference to '_countries_devel_generate'
- countries_devel_generate in ./
countries.devel_generate.inc - Implements hook_devel_generate().
File
- ./
countries.devel_generate.inc, line 23 - Devel Generate module integration.
Code
function _countries_devel_generate($object, $field, $instance, $bundle) {
$cache =& drupal_static(__FUNCTION__, array());
if (!isset($cache[$field['field_name']])) {
$countries = array();
foreach (countries_options_list($field) as $iso2 => $name) {
$countries[$iso2]['iso2'] = $iso2;
}
$cache[$field['field_name']] = $countries;
}
return $cache[$field['field_name']][array_rand($cache[$field['field_name']])];
}