You are here

function search_api_get_data_type_info in Search API 7

Returns either all custom field type definitions, or a specific one.

Parameters

$type: If specified, the type whose definition should be returned.

Return value

array If $type was not given, an array containing all custom data types, in the format specified by hook_search_api_data_type_info(). Otherwise, the definition for the given type, or NULL if it is unknown.

See also

hook_search_api_data_type_info()

4 calls to search_api_get_data_type_info()
SearchApiIndex::index in includes/index_entity.inc
Indexes items on this index.
search_api_admin_index_fields in ./search_api.admin.inc
Form constructor for setting the indexed fields.
search_api_admin_index_fields_submit in ./search_api.admin.inc
Form submission handler for search_api_admin_index_fields().
search_api_field_types in ./search_api.module
Returns all field types recognized by the Search API framework.

File

./search_api.module, line 1995
Provides a flexible framework for implementing search services.

Code

function search_api_get_data_type_info($type = NULL) {
  $types =& drupal_static(__FUNCTION__);
  if (!isset($types)) {
    $default_types = search_api_default_field_types();
    $types = module_invoke_all('search_api_data_type_info');
    $types = $types ? $types : array();
    foreach ($types as &$type_info) {
      if (!isset($type_info['fallback']) || !isset($default_types[$type_info['fallback']])) {
        $type_info['fallback'] = 'string';
      }
    }
    drupal_alter('search_api_data_type_info', $types);
  }
  if (isset($type)) {
    return isset($types[$type]) ? $types[$type] : NULL;
  }
  return $types;
}