function taxonomy_xml_formats in Taxonomy import/export via XML 7
Same name and namespace in other branches
- 5.2 taxonomy_xml.module \taxonomy_xml_formats()
- 5 taxonomy_xml.module \taxonomy_xml_formats()
- 6.2 taxonomy_xml.module \taxonomy_xml_formats()
- 6 taxonomy_xml.module \taxonomy_xml_formats()
Return a list of available file formats.
Scan the module directory for appropriate inc files. More can be added as appropriate.
A taxonomy_xml *_format.inc file should prvide an implimentation of the hooks taxonomy_xml_FORMAT_parse() and/or taxonomy_xml_FORMAT_create() to support reading or writing respectively.
It may also check for further dependencies (ARC) as needed.
Return value
array an Array ( [csv_format] => CSV [rdf_format] => RDF [xml_format] => XML )
5 calls to taxonomy_xml_formats()
- local_taxonomy_service_form in services/
local.taxonomy_service.inc - A sub-form that provides UI additions to the taxonomy import form
- lookup_taxonomy_service_form in services/
lookup.taxonomy_service.inc - A sub-form that provides UI additions to the taxonomy import form
- taxonomy_xml_format_info in ./
taxonomy_xml.module - Return info array describing a supported format.
- upload_taxonomy_service_form in services/
upload.taxonomy_service.inc - A sub-form that provides UI additions to the taxonomy import form
- url_taxonomy_service_form in services/
url.taxonomy_service.inc - A sub-form that provides UI additions to the taxonomy import form
File
- ./
taxonomy_xml.module, line 338 - Make it possible to import and export taxonomies as XML documents.
Code
function taxonomy_xml_formats() {
$module_dir = drupal_get_path('module', 'taxonomy_xml');
$incs = file_scan_directory($module_dir . '/formats', '/.*_format.inc/');
$formats = array();
foreach ($incs as $filepath => $file) {
include_once DRUPAL_ROOT . '/' . $filepath;
$format_name = preg_replace('/_format$/', '', $file->name);
$funcname = "taxonomy_xml_{$format_name}_requirements";
$error = function_exists($funcname) ? $funcname() : NULL;
if (empty($error)) {
$formats[$format_name] = drupal_strtoupper($format_name);
}
else {
drupal_set_message($error['taxonomy_xml_' . $format_name]['description'], 'warning');
}
}
return $formats;
}