function local_taxonomy_service_form in Taxonomy import/export via XML 7
A sub-form that provides UI additions to the taxonomy import form
1 string reference to 'local_taxonomy_service_form'
- local_taxonomy_service_info in services/
local.taxonomy_service.inc - hook_taxonomy_service_info()
File
- services/
local.taxonomy_service.inc, line 30 - declare how to import a taxonomy from local sources.
Code
function local_taxonomy_service_form($form_values, $service_info) {
$form = array();
// List available files
$search_paths = array(
drupal_get_path('module', 'taxonomy_xml') . '/samples',
'public://taxonomy_xml',
);
$files = array();
foreach ($search_paths as $search_path) {
$found = file_scan_directory($search_path, '|.*|');
foreach ($found as $file) {
$files[$search_path][$file->uri] = $file->filename;
}
}
$form['filepath'] = array(
'#type' => 'select',
'#title' => t('File to import'),
'#options' => $files,
'#description' => t('Files can be made available by placing them in the sites filesystem at either public://taxonomy_xml or private://taxonomy_xml'),
);
$formats = taxonomy_xml_formats();
$form['format'] = array(
'#type' => 'select',
'#title' => t('Format of file'),
'#default_value' => $form_values['format'],
'#options' => $formats,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Import from ' . $service_info['name']),
'#submit' => array(
'local_taxonomy_service_form_submit',
),
);
return $form;
}