You are here

function imagefield_node_import_fields_alter in Node import 6

Implementation of hook_node_import_fields_alter().

File

supported/imagefield/imagefield.inc, line 11
Support file for the CCK ImageField module.

Code

function imagefield_node_import_fields_alter(&$fields, $type) {
  foreach (node_import_cck_fields($type, 'filefield') as $fieldname => $fieldinfo) {
    if ($fieldinfo['widget']['module'] == 'imagefield') {
      $cck_fieldname = node_import_cck_name($fieldname, 'data');
      foreach (imagefield_filefield_data_info() as $key => $datainfo) {
        $data_fieldname = $cck_fieldname . ':' . $key;
        if (isset($fields[$data_fieldname])) {
          switch ($key) {
            case 'alt':
              $fields[$data_fieldname]['title'] = $fieldinfo['widget']['label'] . ' - ' . $datainfo['title'];
              $fields[$data_fieldname]['is_mappable'] = $fieldinfo['widget']['custom_alt'];
              $fields[$data_fieldname]['default_value'] = $fieldinfo['widget']['alt'];
              break;
            case 'title':
              $fields[$data_fieldname]['title'] = $fieldinfo['widget']['label'] . ' - ' . $datainfo['title'];
              $fields[$data_fieldname]['is_mappable'] = $fieldinfo['widget']['custom_title'];
              $fields[$data_fieldname]['default_value'] = $fieldinfo['widget']['title'];
              break;
          }
        }
      }
    }
  }
}