You are here

public function CSV::encode in Apigee Edge 8

Encodes field data to the target format.

Parameters

array $data: Data to be encoded.

Return value

string Encoded data.

Overrides FieldStorageFormatInterface::encode

File

src/Plugin/ApigeeFieldStorageFormat/CSV.php, line 57

Class

CSV
CSV formatter for Apigee Edge field storage.

Namespace

Drupal\apigee_edge\Plugin\ApigeeFieldStorageFormat

Code

public function encode(array $data) : string {
  $values = array_map(function (array $item) {
    return $item['value'];
  }, $data);
  return trim($this
    ->writeCommaSeparatedValues([
    $values,
  ]));
}