Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding both kreyu_data_table and table blocks in theme ignores the table block #152

Closed
Kreyu opened this issue Nov 29, 2024 · 1 comment · Fixed by #154
Closed

Overriding both kreyu_data_table and table blocks in theme ignores the table block #152

Kreyu opened this issue Nov 29, 2024 · 1 comment · Fixed by #154

Comments

@Kreyu
Copy link
Owner

Kreyu commented Nov 29, 2024

Issue described in the #103 (comment). Using a custom theme that looks like this:

{% extends '@KreyuDataTable/themes/base.html.twig' %}

{% block kreyu_data_table %}
    {{ parent() }}
{% endblock %}

{% block table %}
    ...
{% endblock %}

...will ignore the table block completely and render it from parent template.

This is due to block function call without passing the theme variable as second argument:

<turbo-frame id="kreyu_data_table_{{ name }}" target="_top">
<div
data-controller="{{ stimulus_controllers|join(' ') }}"
data-kreyu--data-table-bundle--state-url-query-parameters-value="{{ url_query_parameters|default({})|json_encode }}"
>
{{ block('action_bar') }}
{{ block('table') }}
{% if pagination_enabled %}
{{ data_table_pagination(pagination) }}
{% endif %}
</div>
</turbo-frame>
{% endblock %}

@Kreyu
Copy link
Owner Author

Kreyu commented Nov 29, 2024

Fixed in v0.25.7.

I've tried with custom theme like so:

{% extends '@KreyuDataTable/themes/base.html.twig' %}

{% block kreyu_data_table %}
    kreyu_data_table
    {{ parent() }}
{% endblock %}

{% block table %}
    table
    {{ parent() }}
{% endblock %}

and now it renders properly:

image

Ping @davidromani FYI 👋🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant