Feature request: data_table_theme twig token
Create a data_table_theme token like the form_theme token (https://symfony.com/doc/current/form/form_themes.html#applying-themes-to-single-forms).
This would make it possible to define custom theme blocks limited to one table.
Exemple :
{% data_table_theme products _self %}
{% block content %}
<div class="container-fluid">
{{ data_table(products) }}
</div>
{% endblock %}
{% block column_phone_number_value %}
specific theme
{% endblock %}
PS: awesome work !
Hey. Thanks for the suggestion. The rendering process of this bundle is much simpler than in forms, and it should be easy to implement, by simply updating the themes key in the vars array of the DataTableView.
PS: awesome work !
Thank you! :)
I've implemented the Twig token and merged. It will be included in the next release.
Similar to forms, you can set the data table themes directly in the Twig template, by using the data_table_theme tag:
{% data_table_theme products 'themes/data_table.html.twig' %}
{{ data_table(products) }}
If you wish to use multiple themes, pass an array using the with keyword:
{% data_table_theme products with [
'themes/data_table.html.twig',
'@KreyuDataTable/themes/bootstrap_5.html.twig',
] %}
{{ data_table(products) }}
If you wish to disable currently configured themes for the data table and only use given ones, add the only keyword after the list of data table themes:
{% data_table_theme products with ['themes/data_table.html.twig'] only %}
{{ data_table(products) }}
Available in 0.18.0