From b14d0d463867f7aaf02cf3570a9e290e7ab5d35e Mon Sep 17 00:00:00 2001 From: optiktr <62912357+optiktr@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:27:34 +0300 Subject: [PATCH] Update CsvExporter.php When exporting via CSV, the comma (,) issue has been fixed and code to change the separator has been added. At the same time, the HTML tag residue that occurred when exporting was eliminated with "strip_tag". --- src/Grid/Exporters/CsvExporter.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Grid/Exporters/CsvExporter.php b/src/Grid/Exporters/CsvExporter.php index 24c05580..73683cd4 100644 --- a/src/Grid/Exporters/CsvExporter.php +++ b/src/Grid/Exporters/CsvExporter.php @@ -173,12 +173,12 @@ public function export() // Write title if (empty($titles)) { - fputcsv($handle, $titles = $this->getVisiableTitles()); + fputcsv($handle, $titles = $this->getVisiableTitles(), ';'); // Seperator to ";" from "," for title } // Write rows foreach ($current as $index => $record) { - fputcsv($handle, $this->getVisiableFields($record, $original[$index])); + fputcsv($handle, $this->getVisiableFields($record, $original[$index]), ';'); // Seperator to ";" from "," for rows } }); fclose($handle); @@ -254,9 +254,11 @@ protected function getColumnValue(string $column, $value, $original) } if (isset($this->columnCallbacks[$column])) { - return $this->columnCallbacks[$column]($value, $original); + $processedValue = $this->columnCallbacks[$column]($value, $original); + // HTML etiketlerini kaldır + return strip_tags($processedValue); } - - return $value; + // HTML etiketlerini kaldır + return strip_tags($value); } }