You are here

protected function CSVExporter::collapseCell in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/CSVExporter.php \AKlump\LoftDataGrids\CSVExporter::collapseCell()

Collapse a single cell in a row.

Parameters

array $cell:

Return value

string

2 calls to CSVExporter::collapseCell()
CSVExporter::collapseRow in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/CSVExporter.php
Collapse a row
HTMLExporter::collapseCell in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/HTMLExporter.php
Collapse a single cell in a row.
1 method overrides CSVExporter::collapseCell()
HTMLExporter::collapseCell in vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/HTMLExporter.php
Collapse a single cell in a row.

File

vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/CSVExporter.php, line 98

Class

CSVExporter
Class CSVExporter

Namespace

AKlump\LoftDataGrids

Code

protected function collapseCell($cell, $column) {

  //compress a complex cell
  if (is_array($cell)) {
    $cell = isset($cell['data']) ? $cell['data'] : '';
  }
  if (!$this->format->html) {
    $cell = strip_tags($cell);
  }

  // Escape chars that conflice with delimiters
  if (!empty($this->format->escape)) {
    $escapeables = array(
      $this->format->left,
      $this->format->right,
    );
    $escapeables = array_filter(array_unique($escapeables));
    foreach ($escapeables as $find) {
      $cell = str_replace($find, $this->format->escape . $find, $cell);
    }
  }
  return $this->format->left . $cell . $this->format->right;
}