1

I was thinking to get twig outputs so I could use these twig variables on a form.html.twig such as below:

    <div class="row">
        <div class="col-md-6">
            {{ form.name }}
            {{ form.mail }}
            {{ form.subject }}
        </div>
        <div class="col-md-6">
            {{ form.body }}
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            {{ form.submit }}
        </div>
    </div>

Any idea how to get the similar variables via hooks on MYTHEME.theme?

1

I found out a solution which I ended with using {{ element.[machine name] }} instead of {{ children }} on my custom template which is cloned by form.html.twig. The result of the code look similar below:

    <div class="row">
        <div class="col-md-6">
            {{ element.name }}
            {{ element.mail }}
            {{ element.subject }}
        </div>
        <div class="col-md-6">
            {{ element.body }}
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            {{ element.submit }}
        </div>
    </div>

If you have other suggestion, I am happy to know! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.