You are here

function taxonomy_xml_lookup_services in Taxonomy import/export via XML 6

Same name and namespace in other branches
  1. 6.2 taxonomy_xml.module \taxonomy_xml_lookup_services()

Return a list of known taxonomy services. Optionally filtered by type, or formatted for re-use.

Parameters

$type if set, return only services of the named type. currently: 'search' or 'lookup'

$mode either 'full', 'options' or 'links': full returns the whole description, options returns an array suitable for use in select box, links may return a list linked to more information about the service. TODO

Return value

A structured array describing each service and how it can be invoked

4 calls to taxonomy_xml_lookup_services()
taxonomy_xml_about_services in ./taxonomy_xml.module
Admin help page listing details of available services A menu page callback
taxonomy_xml_add_all_children_to_queue in ./taxonomy_xml.module
If the currently processing term refers to other terms by URI, set up a process to retrieve them recursively later.
taxonomy_xml_import_form in ./taxonomy_xml.module
Builds the import form.
taxonomy_xml_import_form_submit in ./taxonomy_xml.module
Imports the actual XML.

File

./taxonomy_xml.module, line 1344
taxonomy_xml.module This module makes it possible to import and export taxonomies as XML documents.

Code

function taxonomy_xml_lookup_services($type = NULL, $mode = 'full') {

  // Use a hook lookup to allow any later modules to provide new search services
  static $services;
  if (empty($services)) {
    $services = module_invoke_all('taxonomy_servers');
  }
  $requested = $services;
  if ($type) {

    // filter out unwanted
    foreach ($requested as $id => $service) {
      if ($service['servicetype'] != $type) {
        unset($requested[$id]);
      }
    }
  }
  if ($mode == 'options') {
    $options = array();
    foreach ($requested as $id => $service) {
      $options[$id] = $service['provider'] . " - " . $service['servicename'];
    }
    return $options;
  }
  return $requested;
}