Last active
January 19, 2016 17:45
-
-
Save nietzscheson/36a14e4fe821cc715101 to your computer and use it in GitHub Desktop.
#Symfony, #Twig - Modal Embed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set _title = block('title') %} | |
{% set _body = block('body') %} | |
<div class="modal fade {% if type is defined %} bs-example-modal-{{ type }} {% endif %}" id="{{ id|default('modal')}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
<div class="modal-dialog {% if type is defined %} modal-{{ type }} {% endif %}" role="document"> | |
<div class="modal-content"> | |
{% if _title is not empty %} | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<h4 class="modal-title" id="myModalLabel"> | |
{{ _title|raw }} | |
</h4> | |
</div> | |
{% endif %} | |
<div class="modal-body"> | |
{% if _body is not empty %}{{ _body|raw }}{% endif %} | |
</div> | |
<div class="modal-footer"> | |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | |
</div> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> | |
Launch demo modal | |
</button> | |
{% embed 'MyBundle::Components/modal.html.twig' with { id: 'myModal', type: 'sm'}%} | |
{% block title %} | |
# Title | |
{% endblock %} | |
{% block body %} | |
# Content | |
{% endblock %} | |
{% endembed %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment