Skip to content

Commit f0b4e60

Browse files
authored
Merge pull request #2414 from edwwaarrdd/patch-1
Escape row in data processor also accepts Htmlable.
2 parents 01b4a4f + ec44054 commit f0b4e60

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Processors/DataProcessor.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Yajra\DataTables\Processors;
44

5+
use Illuminate\Contracts\Support\Htmlable;
56
use Illuminate\Support\Arr;
67
use Yajra\DataTables\Utilities\Helper;
78

@@ -253,7 +254,7 @@ protected function escapeColumns(array $output)
253254
}
254255

255256
/**
256-
* Escape all string values of row.
257+
* Escape all string or Htmlable values of row.
257258
*
258259
* @param array $row
259260
* @return array
@@ -263,7 +264,7 @@ protected function escapeRow(array $row)
263264
$arrayDot = array_filter(Arr::dot($row));
264265
foreach ($arrayDot as $key => $value) {
265266
if (! in_array($key, $this->rawColumns)) {
266-
$arrayDot[$key] = is_string($value) ? e($value) : $value;
267+
$arrayDot[$key] = (is_string($value) || $value instanceof Htmlable) ? e($value) : $value;
267268
}
268269
}
269270

0 commit comments

Comments
 (0)