function translation_array2list in Internationalization 5.2
Same name and namespace in other branches
- 5.3 translation/translation.module \translation_array2list()
- 5 translation/translation.module \translation_array2list()
Converts a list of arrays to an array of the form keyfield => namefield
File
- translation/
translation.module, line 1062
Code
function translation_array2list($data, $keyfield, $namefield = 'name') {
foreach ($data as $key => $value) {
if (is_array($data)) {
$list[$value[$keyfield]] = $value[$namefield];
}
else {
$list[$value->{$keyfield}] = $value->{$namefield};
}
}
return $list;
}