Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 623 Bytes

modals.md

File metadata and controls

29 lines (21 loc) · 623 Bytes

Working with the modals

How to open a modal

You need a button with the data-controller="modal-opener" and all the related attributes, e.g.:

<button
    data-controller="modal-opener"
    data-action="modal-opener#fetch"
    data-modal-opener-href-value="{{ path('a route') }}"
>
    Edit
</button>

Write the modal content template

The data-modal-opener-href-value destination view must extend the modal.html.twig template, e.g.:

{% extends 'modal.html.twig' %}

{% block title %}Some modal title{% endblock %}

{% block body %}
    <p>The content of the modal</p>
{% endblock %}