function bundle_clone_admin in bundle clone 7
Bundle field cloning form.
Adds ajax to basic form which updates fields list according to chosen source bunlde.
1 string reference to 'bundle_clone_admin'
File
- ./
bundle_clone.clone.inc, line 7
Code
function bundle_clone_admin($form, &$form_state, $entity_type) {
bundle_clone_config($form, $entity_type);
$form['config']['source']['#ajax'] = array(
'callback' => 'bundle_clone_present_fields',
'wrapper' => 'bundle-clone-fields',
);
$form['wrapper'] = array(
'#type' => 'fieldset',
'#title' => t('Fields'),
'#description' => t('Missing fields will be created and existing will be updated'),
'#prefix' => '<div id="bundle-clone-fields">',
'#suffix' => '</div>',
);
if (isset($form_state['values']['config']['source'])) {
$instances = field_info_instances($entity_type, $form_state['values']['config']['source']);
$options = array(
'all' => t('All'),
);
foreach ($instances as $instance => $info) {
$options[$instance] = $info['label'];
}
$form['wrapper']['fields'] = array(
'#type' => 'select',
'#options' => $options,
'#multiple' => TRUE,
'#default_value' => 'all',
'#required' => TRUE,
);
}
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Clone'),
);
return $form;
}