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

Feature Request: new function html_attr to output html attributes the easy way #3193

Closed
axten opened this issue Nov 12, 2019 · 1 comment
Closed

Comments

@axten
Copy link

axten commented Nov 12, 2019

Hi, I would suggest to add a new helper function to manage html attributes in a simple way.

twig example:

    {% set attr = {
        'aria-expandend': 'false',
        disabled: true,
        hidden: false,
        id: 123,
        title: 'cli"<ck',
    } %}

    <button{{ html_attr(attr) }}>Test</button>

output:

<button aria-expandend="false" disabled id="123" title="cli&quot;&lt;ck">Test</button>

PR: #3199

@fabpot
Copy link
Contributor

fabpot commented Dec 3, 2019

Closing as there is a PR; let's discuss there.

@fabpot fabpot closed this as completed Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants