You are here

function search_api_test_list_callback in Search API 7

List callback.

1 string reference to 'search_api_test_list_callback'
search_api_test_entity_property_info in tests/search_api_test.module
Implements hook_entity_property_info().

File

tests/search_api_test.module, line 196
Test functions and classes for testing the Search API.

Code

function search_api_test_list_callback($data, array $options, $name) {
  if (is_array($data)) {
    $res = is_array($data[$name]) ? $data[$name] : explode(',', $data[$name]);
  }
  else {
    $res = is_array($data->{$name}) ? $data->{$name} : explode(',', $data->{$name});
  }
  if ($name == 'prices') {
    foreach ($res as &$x) {
      $x = (double) $x;
    }
  }
  return array_filter($res);
}