You are here

function location_node_import_defaults in Node import 6

Implementation of hook_node_import_defaults().

File

supported/location/location.inc, line 65
Support file for contrib Location module.

Code

function location_node_import_defaults($type, $defaults, $fields, $map) {
  $form = array();
  if (($node_type = node_import_type_is_node($type)) !== FALSE) {
    $settings = variable_get('location_settings_node_' . $node_type, array());
    if (isset($settings['multiple']['max']) && $settings['multiple']['max'] > 0) {
      foreach (location_field_names() as $fieldname => $fieldtitle) {
        if ($settings['form']['fields'][$fieldname]['collect']) {
          $defaults['location:' . $fieldname] = isset($defaults['location:' . $fieldname]) ? $defaults['location:' . $fieldname] : '';
          $form['location:' . $fieldname] = location_invoke_locationapi($defaults['location:' . $fieldname], 'field_expand', $fieldname, $settings['form']['fields'][$fieldname]['collect'], array());
        }
      }
    }
  }
  return $form;
}