You are here

function locale_node_import_defaults in Node import 6

Implementation of hook_node_import_defaults().

File

supported/locale.inc, line 72
Support file for core locale module.

Code

function locale_node_import_defaults($type, $defaults, $fields, $map) {
  $form = array();
  $options = array(
    '' => t('Language neutral'),
  );
  foreach (language_list() as $code => $data) {
    $options[$code] = t($data->name);
  }
  foreach ($fields as $fieldname => $fieldinfo) {
    if ($fieldinfo['input_format'] == 'language') {
      $form[$fieldname] = array(
        '#title' => isset($fieldinfo['title']) ? $fieldinfo['title'] : t('Language'),
        '#type' => 'select',
        '#default_value' => isset($defaults[$fieldname]) ? $defaults[$fieldname] : '',
        '#options' => $options,
      );
    }
  }
  return $form;
}