You are here

function filefield_node_import_defaults in Node import 6

Implementation of hook_node_import_defaults().

File

supported/filefield/filefield.inc, line 74
Support file for the CCK FileField module.

Code

function filefield_node_import_defaults($type, $defaults, $fields, $map) {
  $form = array();
  foreach (node_import_cck_fields($type, 'filefield') as $fieldname => $fieldinfo) {
    $data_fieldname = node_import_cck_name($fieldname, 'data') . ':description';
    if (isset($fields[$data_fieldname]) && $fields[$data_fieldname]['is_mappable']) {
      $form[$data_fieldname] = array(
        '#title' => $fieldinfo['widget']['label'] . ' - ' . t('Description'),
        '#type' => 'textfield',
        '#maxlength' => 128,
        '#size' => 60,
        '#default_value' => isset($defaults[$data_fieldname]) ? $defaults[$data_fieldname] : $fields[$data_fieldname]['default_value'],
      );
    }
    $list_fieldname = node_import_cck_name($fieldname, 'list');
    if (isset($fields[$list_fieldname]) && $fields[$list_fieldname]['is_mappable']) {
      $form[$list_fieldname] = array(
        '#title' => $fieldinfo['widget']['label'] . ' - ' . t('List'),
        '#type' => 'radios',
        '#options' => array(
          '0' => t('No'),
          '1' => t('Yes'),
        ),
        '#default_value' => isset($defaults[$list_fieldname]) ? $defaults[$list_fieldname] : $fields[$list_fieldname]['default_value'],
      );
    }
  }
  return $form;
}