function word_link_exchange_import_form in Word Link 7.2
Same name and namespace in other branches
- 8 modules/word_link_exchange/word_link_exchange.module \word_link_exchange_import_form()
- 7 modules/word_link_exchange/word_link_exchange.module \word_link_exchange_import_form()
Import form.
1 string reference to 'word_link_exchange_import_form'
- word_link_exchange_menu in modules/
word_link_exchange/ word_link_exchange.module - Implements hook_menu().
File
- modules/
word_link_exchange/ word_link_exchange.module, line 56 - Code for the Word link exchange module.
Code
function word_link_exchange_import_form() {
$form = array();
if (function_exists('taxonomy_get_vocabularies')) {
$vocabularies = taxonomy_get_vocabularies();
}
$delimiter = array(
'semicolon' => t('« ; » (Semicolon)'),
'comma' => t('« , » (Comma)'),
'tabulation' => t('« » (Tabulation)'),
'pipe' => t('« | » (Pipe)'),
'space' => t('« » (Space)'),
'currency_sign' => t('« ¤ » (Currency sign)'),
'custom_delimiter' => t('Custom delimiter'),
);
$form['override_defaults'] = array(
'#type' => 'checkbox',
'#title' => t('Override defaults'),
);
$form['override'] = array(
'#type' => 'container',
'#states' => array(
'invisible' => array(
':input[name="override_defaults"]' => array(
'checked' => FALSE,
),
),
),
);
$form['override']['case_sensitive'] = array(
'#type' => 'checkbox',
'#title' => t('Case sensitive'),
);
// Show import from taxonomy only when we have vocabularies.
if (!empty($vocabularies)) {
$vids = array();
foreach ($vocabularies as $vocabulary) {
$vids[$vocabulary->vid] = $vocabulary->name . ' (vid:' . $vocabulary->vid . ')';
}
$form['taxonomy'] = array(
'#type' => 'fieldset',
'#title' => t('Import from taxonomy'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['taxonomy']['vocabularies'] = array(
'#type' => 'select',
'#title' => t('Select vocabularies'),
'#options' => $vids,
'#multiple' => TRUE,
);
$form['taxonomy']['import_limit'] = array(
'#type' => 'textfield',
'#size' => 4,
'#maxlenghth' => 4,
'#default_value' => 250,
'#title' => t('Import limit'),
'#description' => t('This counts of terms will be processed by one page request.'),
);
}
$form['import'] = array(
'#type' => 'fieldset',
'#title' => t('Import from file'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['import']['file'] = array(
'#type' => 'file',
'#title' => t('CSV file'),
'#size' => 50,
'#description' => t('A comma separated (<em>.csv</em>) file.'),
);
$form['import']['delimiter'] = array(
'#type' => 'select',
'#title' => t('Delimiter'),
'#options' => $delimiter,
);
$form['import']['delimiter_custom'] = array(
'#type' => 'textfield',
'#title' => 'Custom delimiter',
'#size' => 2,
'#maxlength' => 1,
'#description' => t('Specify your custom delimiter.'),
'#states' => array(
'visible' => array(
':input[name=delimiter]' => array(
'value' => 'custom_delimiter',
),
),
),
);
$form['import']['update'] = array(
'#type' => 'checkbox',
'#title' => t('Only update values'),
'#description' => t('If checked, new words will be added and old will be updated. If not, only new words will be added.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Import'),
);
return $form;
}