Skip to content

Commit 909adca

Browse files
authored
Merge pull request yajra#1960 from Spodnet/8.0
[8.0] Added optional merge of config raw columns to rawColumns method.
2 parents 3875123 + 2c9f94d commit 909adca

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/DataTableAbstract.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,21 @@ public function escapeColumns($columns = '*')
248248

249249
/**
250250
* Set columns that should not be escaped.
251+
* Optionally merge the defaults from config.
251252
*
252253
* @param array $columns
254+
* @param bool $merge
253255
* @return $this
254256
*/
255-
public function rawColumns(array $columns)
257+
public function rawColumns(array $columns, $merge = false)
256258
{
257-
$this->columnDef['raw'] = $columns;
259+
if ($merge) {
260+
$config = $this->config->get('datatables.columns');
261+
262+
$this->columnDef['raw'] = array_merge($config['raw'], $columns);
263+
} else {
264+
$this->columnDef['raw'] = $columns;
265+
}
258266

259267
return $this;
260268
}

0 commit comments

Comments
 (0)