You are here

protected function CsvEncoder::formatValue in CSV Serialization 8

Same name and namespace in other branches
  1. 8.2 src/Encoder/CsvEncoder.php \Drupal\csv_serialization\Encoder\CsvEncoder::formatValue()

Formats a single value for a given CSV cell.

Parameters

string $value: The raw value to be formatted.

Return value

string The formatted value.

1 call to CsvEncoder::formatValue()
CsvEncoder::formatRow in src/Encoder/CsvEncoder.php
Formats all cells in a given CSV row.

File

src/Encoder/CsvEncoder.php, line 266

Class

CsvEncoder
Adds CSV encoder support for the Serialization API.

Namespace

Drupal\csv_serialization\Encoder

Code

protected function formatValue($value) {
  if ($this->stripTags) {
    $value = Html::decodeEntities($value);
    $value = strip_tags($value);
  }
  if ($this->trimValues) {
    $value = trim($value);
  }
  return $value;
}