function _cck_phone_custom_cc in Phone Number 7
Same name and namespace in other branches
- 6 cck_phone.module \_cck_phone_custom_cc()
Get list of country codes that has custom includes.
Return value
Array of country codes abbreviation or empty array if none exist.
7 calls to _cck_phone_custom_cc()
- cck_phone_field_instance_settings_form in ./
cck_phone.module - Implements hook_field_instance_settings_form().
- cck_phone_phone_number_validate in ./
cck_phone.module - An #element_validate callback for the phone_number element.
- theme_cck_phone_formatter_global_phone_number in ./
cck_phone.module - Theme function for 'default' or global phone number field formatter.
- theme_cck_phone_formatter_local_phone_number in ./
cck_phone.module - Theme function for 'local' phone number field formatter.
- _cck_phone_cc_options in ./
cck_phone.module - Generate an array of country codes, for use in select or checkboxes form.
File
- ./
cck_phone.module, line 424 - Defines phone number fields for CCK. Provide some verifications on the phone numbers
Code
function _cck_phone_custom_cc() {
static $countrycodes;
if (!isset($countrycodes)) {
// load custom country codes phone number includes
$path = drupal_get_path('module', 'cck_phone') . '/includes';
// scan include phone numbers directory
$files = file_scan_directory($path, '/^phone\\..*\\.inc$/');
$countrycodes = array();
foreach ($files as $file) {
module_load_include('inc', 'cck_phone', '/includes/' . $file->name);
list($dummy, $countrycode) = explode('.', $file->name);
// faster using array key
$countrycodes[$countrycode] = $countrycode;
}
}
return $countrycodes;
}