You are here

function taxonomy_xml_format_info in Taxonomy import/export via XML 7

Return info array describing a supported format.

Uses the sub-hook taxonomy_xml_FORMATID_format_info() The format libraries themselves should create this function.

This also inspects the available functions to record which provide import (parse) and export (create) hooks.

2 calls to taxonomy_xml_format_info()
taxonomy_xml_cached_get_contents in ./taxonomy_xml.module
A caching version of file_get_contents.
taxonomy_xml_export in ./taxonomy_xml.export.inc
Displays an unordered list of all available vocabularies for export.

File

./taxonomy_xml.module, line 374
Make it possible to import and export taxonomies as XML documents.

Code

function taxonomy_xml_format_info($requested_format_id = NULL) {
  $formats = taxonomy_xml_formats();
  $info = array();
  foreach ($formats as $format_id => $format_name) {
    taxonomy_xml_load_format($format_id);
    $info_funcname = "taxonomy_xml_{$format_id}_format_info";
    $info[$format_id] = function_exists($info_funcname) ? $info_funcname() : array();
    $info[$format_id]['name'] = $format_name;
    $create_funcname = "taxonomy_xml_{$format_id}_create";
    if (function_exists($create_funcname)) {
      $info[$format_id]['create'] = $create_funcname;
    }
  }
  if (!empty($requested_format_id)) {
    return $info[$requested_format_id];
  }
  return $info;
}