You are here

protected function SearchApiHighlight::flattenArrayValues in Search API 7

Flattens a (possibly multidimensional) array into a string.

Parameters

array $array: The array to flatten.

string $glue: (optional) The separator to insert between individual array items.

Return value

string The glued string.

2 calls to SearchApiHighlight::flattenArrayValues()
SearchApiHighlight::highlightField in includes/processor_highlight.inc
Marks occurrences of the search keywords in a text field.
SearchApiHighlight::postprocessSearchResults in includes/processor_highlight.inc
Does nothing.

File

includes/processor_highlight.inc, line 513
Contains the SearchApiHighlight class.

Class

SearchApiHighlight
Processor for highlighting search results.

Code

protected function flattenArrayValues(array $array, $glue = " \n\n ") {
  $ret = array();
  foreach ($array as $item) {
    if (is_array($item)) {
      $ret[] = $this
        ->flattenArrayValues($item, $glue);
    }
    else {
      $ret[] = $item;
    }
  }
  return implode($glue, $ret);
}