You are here

function fac_get_service_info in Fast Autocomplete 7

Returns either a list of all available service infos, or a specific one.

Parameters

string|null $id: The ID of the service info to retrieve.

Return value

array If $id was not specified, an array of all available service classes. Otherwise, either the service info with the specified id (if it exists), or NULL. Service class information is formatted as specified by hook_fac_service_info(), with the addition of a "module" key specifying the module that adds a certain class.

See also

hook_fac_service_info()

1 call to fac_get_service_info()
fac_settings_form in inc/fac.admin.inc
Fast AutoComplete settings form.
2 string references to 'fac_get_service_info'
fac_modules_disabled in ./fac.module
Implements hook_modules_disabled().
fac_modules_enabled in ./fac.module
Implements hook_modules_enabled().

File

./fac.module, line 403
This file contains the main functions of the Fast Autocomplete module.

Code

function fac_get_service_info($id = NULL) {
  $services =& drupal_static(__FUNCTION__);
  if (!isset($services)) {

    // Inlined version of module_invoke_all() to add "module" keys.
    $services = array();
    foreach (module_implements('fac_service_info') as $module) {
      $function = $module . '_fac_service_info';
      if (function_exists($function)) {
        $new_services = $function();
        if (isset($new_services) && is_array($new_services)) {
          foreach ($new_services as $service => $info) {
            $new_services[$service] += array(
              'module' => $module,
            );
          }
        }
        $services += $new_services;
      }
    }
  }
  if (isset($id)) {
    return isset($services[$id]) ? $services[$id] : NULL;
  }
  return $services;
}