You are here

function _search_api_convert_custom_type in Search API 7

Helper function for converting data to a custom type.

1 call to _search_api_convert_custom_type()
SearchApiIndex::index in includes/index_entity.inc
Indexes items on this index.

File

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

Code

function _search_api_convert_custom_type($callback, $value, $original_type, $type, $nesting_level) {
  if ($nesting_level == 0) {
    return call_user_func($callback, $value, $original_type, $type);
  }
  if (!is_array($value)) {
    return NULL;
  }
  --$nesting_level;
  $values = array();
  foreach ($value as $v) {
    $v = _search_api_convert_custom_type($callback, $v, $original_type, $type, $nesting_level);
    if (isset($v) && !(is_array($v) && !$v)) {
      $values[] = $v;
    }
  }
  return $values;
}