You are here

function taxonomy_xml_lookup_services in Taxonomy import/export via XML 6.2

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

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

The sample services distributed with this module are in the file lookup_services.inc

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

See also

taxonomy_xml_taxonomy_servers()

7 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
Queue up an import action.
taxonomy_xml_fetch_and_import in ./taxonomy_xml.module
Fetches the data according to the given method, then invokes the import on that data.
taxonomy_xml_import_form in ./taxonomy_xml.module
Builds the import form.
taxonomy_xml_source_features_export in ./taxonomy_xml.features.inc
Implementation of hook_features_export().

... See full list

File

./taxonomy_xml.module, line 2200
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
  module_load_include('inc', 'taxonomy_xml', 'lookup_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') {

    // Return an array suitable for use in a form select element
    $options = array();
    foreach ($requested as $id => $service) {
      $options[$id] = $service['provider'] . " - " . $service['name'];
    }
    return $options;
  }
  return $requested;
}