Skip to content

Instantly share code, notes, and snippets.

@chrisguitarguy
Last active February 10, 2017 15:33
Show Gist options
  • Save chrisguitarguy/5f51127a77288c824c02 to your computer and use it in GitHub Desktop.
Save chrisguitarguy/5f51127a77288c824c02 to your computer and use it in GitHub Desktop.
How to use Bootstrap input groups (http://getbootstrap.com/components/#input-groups) in a Symfony form theme
{% form_theme form 'theme.html.twig' %}
{# the theme above will take care of rendering the input group #}
{{ form(form) }}
{# form_name will be the name of your form type #}
{# field_name is the name of the field #}
{# See http://symfony.com/doc/current/cookbook/form/form_customization.html#how-to-customize-an-individual-field #}
{% block _form_name_field_name_widget -%}
<div class="input-group">
{{- block('form_widget_simple') -}}
<span class="input-group-btn">
<button type="button" class="btn btn-default">
Do Stuff
</button>
</span>
</div>
{%- endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment