Skip to content

Allow false value for data attribute in HTML attributes extension #4849

Description

@laurentmuller

I use the bootstrap-table plugin in my Symfony project.

For the column definitions, I use the html_attr Twig function. I want to hide some columns with the visible property.

{% macro output_column(column) -%}
    {% set attrs = {
        'data-field': column.field,
        'data-align': column.align,
        'data-visible': column.visible
    } %}
    <th {{ html_attr(attrs) }}>
        {{ column.title }}
    </th>
{%- endmacro %}

But when the visible property of the column is false, then the attribute is removed. So I cannot hide the column.

It will be nice to use the same behavior as for aria-* attributes (convert the boolean false value to 'false' string).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions