function values_import_form in Values 6
Same name and namespace in other branches
- 7 values.module \values_import_form()
Import a value list
1 string reference to 'values_import_form'
- values_menu in ./
values.module - Implementation of hook_menu().
File
- ./
values.module, line 512 - API for managing reusable value sets.
Code
function values_import_form(&$form_state) {
drupal_set_message(t('Importing a value list with a conflicting name will override it.'), 'warning');
$form['import_type'] = array(
'#type' => 'radios',
'#title' => t('Import Type'),
'#options' => array(
'ctools' => 'Ctools Export',
'values' => 'key|value pairs',
),
'#default_value' => 'ctools',
);
$form['import'] = array(
'#type' => 'textarea',
'#title' => t('Import data'),
'#description' => t('Copy the text from an previously exported value list and paste it here.'),
'#default_value' => isset($form_state['values']['import']) ? $form_state['values']['import'] : '',
'#rows' => 10,
);
$form['import_values'] = array(
'#type' => 'fieldset',
'#title' => t('Import Values'),
'#description' => 'Import a new value set as a flat set of key|value pairs. Useful for migrating from allowed values lists to value sets.',
'#collapsible' => FALSE,
'#attributes' => array(
'id' => 'import-values-wrapper',
),
);
$form['import_values']['description'] = array(
'#type' => 'textfield',
'#title' => t('Value set description'),
'#description' => t('This description will appear on the administrative table to tell you what the values are about.'),
'#default_value' => '',
'#required' => TRUE,
);
// Wrapper for values
$form['import_values']['values'] = array(
'#type' => 'textarea',
'#title' => t('Import data'),
'#description' => t('Enter one value per line. Use the format key|value.'),
'#default_value' => '',
'#rows' => 10,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Import'),
);
$form['#after_build'] = array(
'values_import_form_add_js',
);
return $form;
}