omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
255 stars 114 forks source link

Passing variables #102

Closed polo195pl closed 4 years ago

polo195pl commented 4 years ago

How can i pass variable into TwigColumn?

polo195pl commented 4 years ago

Variables is auto passing. You can check in twig via {{ dump() }}

curry684 commented 4 years ago

Curious - was the documentation on this unclear?

https://omines.github.io/datatables-bundle/#twigcolumn

norbert-n commented 3 years ago

Its not unclear, but for me it looks like a workaround if i need to pass a controller variable to the template. now i have to inject the twig environment in my controller action and call $twig->addGlobal('name', $variable ); It would be nice to just have

$table->add(
            'name',
            TwigColumn::class,
            ['variables' => ['name' => $variable],
...

or something like that