$field_info) {
if (!empty($field_map[$field_name]['bundles'][$target_type])) {
$available_bundles = $field_map[$field_name]['bundles'][$target_type];
// Determine all targeted bundles that use this field.
$option_bundles = empty($target_bundles) ? $available_bundles : array_intersect($target_bundles, $available_bundles);
if (!empty($option_bundles)) {
$field_options[$field_name] = t(
'@field_label (@field_name): Available in bundle(s) @bundles',
array(
'@field_label' => $field_info['label'],
'@field_name' => $field_name,
'@bundles' => implode(', ', $option_bundles),
)
);
}
}
}
$form['overwrite'] = array(
'#type' => 'checkbox',
'#title' => t('Overwrite existing data'),
'#description' => t('Select if you want to overwrite fields that already have values.
NOTE: Disabling this is experimental and might not work 100%. If you experience issues with fields being overridden nonetheless, please report what field type and settings this occurs on in the modules issue queue on drupal.org'),
'#default_value' => isset($settings['overwrite']) ? $settings['overwrite'] : 1,
);
if (empty($field_options)) {
$no_fields_found = t('There are no common fields between this bundle and its referenced entities.');
$usage_instructions = t('To use autofill, you need to add instances of the same fields to its referenced bundles.');
$form['no_fields'] = array(
'#markup' => '