You are here

protected function SearchApiViewsQuery::extractFields in Search API 7

Helper function for extracting all necessary fields from a result item.

Usually, this method isn't needed anymore as the properties are now extracted by the field handlers themselves.

1 call to SearchApiViewsQuery::extractFields()
SearchApiViewsQuery::addResults in contrib/search_api_views/includes/query.inc
Helper function for adding results to a view in the format expected by the view.

File

contrib/search_api_views/includes/query.inc, line 507
Contains SearchApiViewsQuery.

Class

SearchApiViewsQuery
Views query class using a Search API index as the data source.

Code

protected function extractFields(EntityMetadataWrapper $wrapper, array $all_fields) {
  $fields = array();
  foreach ($all_fields as $key => $true) {
    $fields[$key]['type'] = 'string';
  }
  $fields = search_api_extract_fields($wrapper, $fields, array(
    'sanitized' => TRUE,
  ));
  $ret = array();
  foreach ($all_fields as $key => $true) {
    $ret[$key] = isset($fields[$key]['value']) ? $fields[$key]['value'] : '';
  }
  return $ret;
}