{% extends "MopaBootstrapSandboxBundle::layout.html.twig" %} {% from 'MopaBootstrapBundle::flash.html.twig' import session_flash %} {% block headline %}Extended Forms Views{% endblock headline %} {% block content %}
Example extended forms via view {{ form_row(form.textfield1, {'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}}) }} {{ form_row(form.textfield2, {'attr': {'class': 'input-medium', 'placeholder': 'input-medium'}}) }} {{ form_row(form.textfield3, {'attr': {'class': 'input-large', 'placeholder': 'input-large'}}) }} {{ form_row(form.select1, {'attr': {'class': 'input-mini'}}) }} {{ form_row(form.select2, {'attr': {'class': 'input-medium'}}) }} {{ form_row(form.select3, {'attr': {'class': 'input-large'}}) }} {{ form_row(form.prepend1, {'label': 'Prepended Text', 'widget_addon': {'type': 'prepend', 'text': '@'}, 'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}}) }} {{ form_row(form.prepend2, {'label': 'Prepended Icon', 'widget_addon': {'type': 'prepend', 'icon': 'headphones'}, 'attr': {'class': 'input-large', 'placeholder': 'Which kind of music?'}}) }} {{ form_row(form.append1, {'label': 'Appended Text', 'widget_addon': {'type': 'append', 'text': '.00'}, 'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}}) }} {{ form_row(form.append2, {'label': 'Appended Icon', 'widget_addon': {'type': 'append', 'icon': 'pencil'}, 'attr': {'class': 'input-large', 'placeholder': 'Which kind of books?'}}) }} {{ form_row(form.checkboxesinline, {'label': 'Inline Checkboxes', 'widget_type': 'inline'}) }} {{ form_row(form.checkboxes, {'label': 'Checkboxes'}) }} {{ form_row(form.radiobuttons, {'help_block': 'Note: Labels surround all the options for much larger click areas and a more usable form.'}) }} {{ form_row(form.publicVisible, {'label': 'publicVisible', 'required': 'false'}) }} {{ form_row(form.time1, {}) }} {{ form_row(form.Prefix_Text, {'widget_prefix': "Prefix Text", 'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}}) }} {{ form_row(form.Suffix_Text, {'widget_suffix': "Suffix Text", 'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}}) }} {{ form_row(form.Money_default, {'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}}) }} {{ form_row(form.Money_append, {'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}, 'widget_addon': {'type': 'append'}}) }} {{ form_row(form.Money_prepend, {'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}, 'widget_addon': {'type': 'prepend'}}) }} {{ form_row(form.Money_nothing, {'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}, 'widget_addon': {'type': false}}) }} {{ form_row(form.Percent_default, {'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}}) }} {{ form_row(form.Percent_append, {'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}, 'widget_addon': {'type': 'append'}}) }} {{ form_row(form.Percent_prepend, {'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}, 'widget_addon': {'type': 'prepend'}}) }} {{ form_row(form.Percent_nothing_added, {'attr': {'class': 'input-mini', 'placeholder': 'input-mini'}, 'widget_addon': {'type': false}}) }}

Everything's included

All things shown here are directly included via the bundle.

You can completely drive the appearence within view too, and hopefully updates wont change the anything!!

An example: to generate a nice input field with appended icon:

$builder
    ->add('appendedicon')
;
    

and in your twig template:

{% raw %}
{{ form_row(form.appendedicon,
    {'label': 'Appended Icon',
     'widget_addon': {'type': 'append',
                      'icon': 'headphones'},
     'attr': {'class': 'input-large',
              'placeholder': 'What kind of music do you like?'}
    }) }}
{% endraw %}

Detailed Examples!

Have a look into the source code of this template and its form class and see how this page is completely view driven

{% endblock content %} {% set showTemplate = _self %}{% set showForm = formType %}