public function CsvEncoder::expandRow in CSV Serialization 8
Same name and namespace in other branches
- 8.2 src/Encoder/CsvEncoder.php \Drupal\csv_serialization\Encoder\CsvEncoder::expandRow()
Explodes multiple, concatenated values for all cells in a row.
Parameters
array $row: The row of CSV cells.
Return value
array The same row of CSV cells, with each cell's contents exploded.
1 call to CsvEncoder::expandRow()
- CsvEncoder::decode in src/
Encoder/ CsvEncoder.php - Decodes a string into PHP data.
File
- src/
Encoder/ CsvEncoder.php, line 304
Class
- CsvEncoder
- Adds CSV encoder support for the Serialization API.
Namespace
Drupal\csv_serialization\EncoderCode
public function expandRow(array $row) {
foreach ($row as $column_name => $cell_data) {
// @todo Allow customization of this in-cell separator.
if (strpos($cell_data, '|') !== FALSE) {
$row[$column_name] = explode('|', $cell_data);
}
}
return $row;
}