You are here

protected static function RowsOfMultiValueFields::arrayToString in Search API 8

Converts an array of string data into a comma separated string.

Parameters

array $array: A multidimensional array of string data.

Return value

string A comma separated string.

1 call to RowsOfMultiValueFields::arrayToString()
RowsOfMultiValueFields::renderCell in src/Contrib/RowsOfMultiValueFields.php

File

src/Contrib/RowsOfMultiValueFields.php, line 35

Class

RowsOfMultiValueFields
Outputs multi-valued data as comma-separated values.

Namespace

Drupal\search_api\Contrib

Code

protected static function arrayToString(array $array) {
  $elements = [];
  foreach ($array as $element) {
    $elements[] = is_array($element) ? '"' . static::arrayToString($element) . '"' : $element;
  }
  return implode(',', $elements);
}