Skip to content

Commit a4dc2be

Browse files
authored
Update Builder.php
Allow using callbacks as a data value.
1 parent e51ff13 commit a4dc2be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Html/Builder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ protected function makeDataScript(array $data)
260260
{
261261
$script = '';
262262
foreach ($data as $key => $value) {
263-
$script .= PHP_EOL . "data.{$key} = '{$value}';";
263+
$dataValue = $this->isCallbackFunction($value, $key) ? $value : "'{$value}'";
264+
$script .= PHP_EOL . "data.{$key} = {$dataValue};";
264265
}
265266

266267
return $script;

0 commit comments

Comments
 (0)