Skip to content

Instantly share code, notes, and snippets.

@chmielot
Created June 15, 2011 11:12
Show Gist options
  • Save chmielot/1026894 to your computer and use it in GitHub Desktop.
Save chmielot/1026894 to your computer and use it in GitHub Desktop.
Form theming
{% extends "BUMToolboxBundle::layout.html.twig" %}
{% form_theme form _self %}
{# ============== Customizations to rendering ===================== #}
{% block field_label %}
{% spaceless %}
<label for="{{ id }}"{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>{{ label|trans }}
{#
{% if required %}
<span class="required" title="Pflichtfeld">*</span>
{% endif %}
#}
</label>
{% endspaceless %}
{% endblock field_label %}
{% block field_row %}
{% spaceless %}
<div>
{{ form_label(form) }}
{{ form_errors(form) }}
{{ form_widget(form) }}
{% if help is defined %}
<span class="help">{{ help }}</span>
{% endif %}
</div>
{% endspaceless %}
{% endblock field_row %}
{# ============== Template ===================== #}
{% block app_header %}
Manifest-Editor
{% endblock %}
{% block content %}
<form class="manifest-form" method="post" action="{{ app.request.requestUri }}">
<div class="content-block booking-data">
<h1>Buchungsdaten</h1>
<div>
{{ form_errors(form) }}
{{ form_row(form.orderId) }}
{{ form_row(form.shipName, { 'help': 'z.B. MS KREUZFAHRT'}) }}
{{ form_row(form.departure, { 'help': '(TT.MM.JJJJ)', 'attr': {'class': 'date'} }) }}
{{ form_row(form.departureShip, { 'help': '(TT.MM.JJJJ)', 'attr': {'class': 'date'} }) }}
{% if manifest is defined %}
Erstellt am: {{ manifest.createdAt|date('d.m.Y') }}
{% endif %}
</div>
</div>
<div id="participants">
{# Loop over all participants #}
{% set i = 1 %}
{% for participant in form.participants %}
<div class="content-block person {{ cycle(['margin', ''], i) }}">
<h1>Teilnehmer {{ i }}</h1>
<div class="part1">
<h2>Daten bitte genau laut Reisepass eingeben.</h2>
{{ form_widget(participant.gender, {'attr': {'class': 'gender'} }) }}
{{ form_row(participant.firstName) }}
{{ form_row(participant.lastName) }}
{{ form_row(participant.street) }}
{{ form_row(participant.streetNumber) }}
{{ form_row(participant.postalCode) }}
{{ form_row(participant.city) }}
</div>
<div class="part2">
{{ form_row(participant.maritalStatus) }}
{{ form_row(participant.occupation) }}
{{ form_row(participant.dateOfBirth, {'help': '(TT.MM.JJJJ)', 'attr': {'class': 'date'} }) }}
{{ form_row(participant.placeOfBirth) }}
{{ form_row(participant.nationality) }}
</div>
<div class="part3">
{{ form_row(participant.phoneNumber) }}
</div>
<div class="part4">
<h2>Passdaten</h2>
{{ form_row(participant.passNumber) }}
{{ form_row(participant.dateOfIssue, {'help': '(TT.MM.JJJJ)', 'attr': {'class': 'date'} }) }}
{{ form_row(participant.dateOfExpiration, {'help': '(TT.MM.JJJJ)', 'attr': {'class': 'date'} }) }}
{{ form_row(participant.placeOfIssue) }}
</div>
{{ form_rest(participant) }}
</div>
{% set i = i + 1 %}
{% endfor %}
</div> {# participants #}
{{ form_rest(form) }}
<div class="clearfix"></div>
<a href="#" id="add_person">Person hinzuf&uuml;gen</a>
<input type="submit" value="Update" />
</form>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment