Skip to content

Commit d50ba8e

Browse files
committed
Tunnel template settings correctly to renderer
1 parent 8afd26c commit d50ba8e

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/DataTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public function getResponse(): JsonResponse
294294
];
295295
if ($this->state->isInitial()) {
296296
$response['options'] = $this->getInitialResponse();
297-
$response['template'] = $this->renderer->renderDataTable($this, $this->settings['template']);
297+
$response['template'] = $this->renderer->renderDataTable($this, $this->template, $this->templateParams);
298298
}
299299

300300
return JsonResponse::create($response);

src/DataTableRendererInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ interface DataTableRendererInterface
2323
* Provides the HTML layout of the configured datatable.
2424
*
2525
* @param DataTable $dataTable
26+
* @param string $template
27+
* @param array $parameters
2628
* @return string
2729
*/
28-
public function renderDataTable(DataTable $dataTable, string $template): string;
30+
public function renderDataTable(DataTable $dataTable, string $template, array $parameters): string;
2931
}

src/Twig/TwigRenderer.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ public function __construct(Twig_Environment $twig = null)
4141
/**
4242
* {@inheritdoc}
4343
*/
44-
public function renderDataTable(DataTable $dataTable, string $template): string
44+
public function renderDataTable(DataTable $dataTable, string $template, array $parameters): string
4545
{
46-
return $this->twig->render($template, [
47-
'datatable' => $dataTable,
48-
]);
46+
$parameters['datatable'] = $dataTable;
47+
return $this->twig->render($template, $parameters);
4948
}
5049
}

0 commit comments

Comments
 (0)