You are here

function translation_array2list in Internationalization 5

Same name and namespace in other branches
  1. 5.3 translation/translation.module \translation_array2list()
  2. 5.2 translation/translation.module \translation_array2list()

Converts a list of arrays to an array of the form keyfield => namefield

File

translation/translation.module, line 1030

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;
}