I have a form made in the YAML Form module and I would like it to open up in a bootstrap modal window.

Can I just put the Bootstrap html into my page.hmtl.twig file and print out the form somehow?

This would be sufficient for my purposes as I want to form to be accessible from all pages on the website.

If this is not the Drupal way could someone please point me in the right direction

1 Answer 1


The drupal way to do this would be to use blocks. The YAML Form module has the feature to put form in blocks. Place the form block in a region, where you want to have it on the page. Then style it in a block template:


<div class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Modal Header</h4>
            <div class="modal-body">
                {{ content }}
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.