function _cck_phone_cc_options in Phone Number 6
Same name and namespace in other branches
- 7 cck_phone.module \_cck_phone_cc_options()
Generate an array of country codes, for use in select or checkboxes form.
Parameters
boolean $show_custom: Mark item with '*' to indicate the country code has include file.
array $country_selection: Limit the list to the countries listed in this array.
Return value
string
2 calls to _cck_phone_cc_options()
- cck_phone_field_settings in ./
cck_phone.module - Implementation of hook_field_settings().
- cck_phone_process in ./
cck_phone.module - Process an individual element.
File
- ./
cck_phone.module, line 344 - Defines phone number fields for CCK. Provide some verifications on the phone numbers
Code
function _cck_phone_cc_options($show_custom = FALSE, $country_selection = array()) {
$options = array();
if ($show_custom) {
$custom_cc = _cck_phone_custom_cc();
}
foreach (cck_phone_countrycodes() as $cc => $value) {
$cc_name = $value['country'] . ' (' . $value['code'] . ')';
// faster using array key instead of in_array
if ($show_custom && isset($custom_cc[$cc])) {
$cc_name .= ' *';
}
if (!empty($country_selection) && $country_selection[$cc] === 0) {
continue;
}
$options[$cc] = check_plain($cc_name);
}
asort($options);
return $options;
}