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

Remove square brackets from getInputHTML #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mediabeastnz
Copy link

It might pay to leave it up to the twig being passed through to have the square brackets.
It's much more difficult to remove [] in twig than it is to add them e.g. json_encode.

For example:

    {% set myArray = [] %}
    {% for item in items %}
        {% set myArray = myArray|merge([{
            'label': item.label,
            'value': item.id
        }]) %}
    {% endfor %}
    {{ myArray | json_encode() | raw }}

This should be left up to the twig code as it's much easier to add square brackets like this in twig than it is to remove them.
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 this pull request may close these issues.

1 participant