You are here

protected function SearchApiAbstractProcessor::implodeTokens in Search API 7

Internal helper function for imploding tokens into a single string.

Parameters

array $tokens: The tokens array to implode.

Return value

string The text data from the tokens concatenated into a single string.

1 call to SearchApiAbstractProcessor::implodeTokens()
SearchApiAbstractProcessor::processField in includes/processor.inc
Method for preprocessing field data.

File

includes/processor.inc, line 328
Contains SearchApiProcessorInterface and SearchApiAbstractProcessor.

Class

SearchApiAbstractProcessor
Abstract processor implementation that provides an easy framework for only processing specific fields.

Code

protected function implodeTokens(array $tokens) {
  $ret = array();
  foreach ($tokens as $token) {
    if (empty($token['value']) && !is_numeric($token['value'])) {

      // Filter out empty tokens.
      continue;
    }
    if (is_array($token['value'])) {
      $ret[] = $this
        ->implodeTokens($token['value']);
    }
    else {
      $ret[] = $token['value'];
    }
  }
  return implode(' ', $ret);
}