function field_tools_bundle_import_form in Field tools 7
Import fields into a bundle.
Parameters
$entity_type: The machine name of the entity.
$bundle: The machine name of the bundle, or a bundle object if the particular entity type has a menu loader for bundles.
1 string reference to 'field_tools_bundle_import_form'
- field_tools_menu in ./
field_tools.module - Implements hook_menu().
File
- ./
field_tools.admin.inc, line 823 - Contains admin callbacks for the Field tools module.
Code
function field_tools_bundle_import_form($form, $form_state, $entity_type, $bundle) {
$form = array();
$form['#entity_type'] = $entity_type;
$form['#bundle'] = field_extract_bundle($entity_type, $bundle);
$form['code'] = field_tools_textarea(t('Field code'));
$form['code']['#required'] = TRUE;
$form['code']['#description'] = t('Paste the code of one or more previously exported fields.');
$form['actions']['import'] = array(
'#type' => 'submit',
'#value' => t('Import'),
);
// Add an action to skip the validation, this means that whatever possible
// will be imported, if any of the fields exist on the target bundle already,
// they will be skipped.
$form['actions']['import_force'] = array(
'#type' => 'submit',
'#value' => t('Import (skip validation)'),
);
return $form;
}