You are here

protected function SearchApiAlterAddCombined::flattenArray in Search API Combined Fields 7

Helper method for flattening a multi-dimensional array.

1 call to SearchApiAlterAddCombined::flattenArray()
SearchApiAlterAddCombined::alterItems in ./callback_add_combined.inc
Alter items before indexing.

File

./callback_add_combined.inc, line 185

Class

SearchApiAlterAddCombined
Search API data alteration callback that adds an URL field for all items.

Code

protected function flattenArray(array $data) {
  $ret = array();
  foreach ($data as $item) {
    if (!isset($item)) {
      continue;
    }
    if (is_scalar($item)) {
      $ret[] = $item;
    }
    else {
      $ret = array_merge($ret, $this
        ->flattenArray($item));
    }
  }
  return $ret;
}