From 627a7f7cd416aa647c2670ee6f4d027ad647646b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 17 Jun 2011 08:39:56 +0200 Subject: [PATCH] [TwigBridge] renamed some block names to avoid collisions --- UPDATE.md | 10 ++++++ .../views/Form/form_div_layout.html.twig | 36 +++++++++---------- .../views/Form/form_table_layout.html.twig | 2 +- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/UPDATE.md b/UPDATE.md index 99f3a1249d..cc3a248ca7 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -6,6 +6,16 @@ one. It only discusses changes that need to be done when using the "public" API of the framework. If you "hack" the core, you should probably follow the timeline closely anyway. +beta5 to RC1 +------------ + +* Some blocks in the Twig Form templates have been renamed to avoid + collisions: + + * `container_attributes` to `widget_container_attributes` + * `attributes` to `widget_attributes` + * `options` to `widget_choice_options` + beta4 to beta5 -------------- diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index e125cfef59..88d5b9afcd 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -47,23 +47,23 @@ {% endspaceless %} {% endblock field_rest %} -{% block attributes %} +{% block widget_attributes %} {% spaceless %} id="{{ id }}" name="{{ full_name }}"{% if read_only %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif %} {% for attrname,attrvalue in attr %}{{attrname}}="{{attrvalue}}" {% endfor %} {% endspaceless %} -{% endblock attributes %} +{% endblock widget_attributes %} -{% block container_attributes %} +{% block widget_container_attributes %} {% spaceless %} id="{{ id }}" {% for attrname,attrvalue in attr %}{{attrname}}="{{attrvalue}}" {% endfor %} {% endspaceless %} -{% endblock container_attributes %} +{% endblock widget_container_attributes %} {% block form_widget %} {% spaceless %} -
+
{{ block('field_rows') }} {{ form_rest(form) }}
@@ -73,7 +73,7 @@ {% block field_widget %} {% spaceless %} {% set type = type|default('text') %} - + {% endspaceless %} {% endblock field_widget %} @@ -102,11 +102,11 @@ {% block textarea_widget %} {% spaceless %} - + {% endspaceless %} {% endblock textarea_widget %} -{% block options %} +{% block widget_choice_options %} {% spaceless %} {% for choice, label in options %} {% if _form_is_choice_group(label) %} @@ -120,29 +120,29 @@ {% endif %} {% endfor %} {% endspaceless %} -{% endblock options %} +{% endblock widget_choice_options %} {% block choice_widget %} {% spaceless %} {% if expanded %} -
+
{% for choice, child in form %} {{ form_widget(child) }} {{ form_label(child) }} {% endfor %}
{% else %} - {% if empty_value is not none %} {% endif %} {% if preferred_choices|length > 0 %} {% set options = preferred_choices %} - {{ block('options') }} + {{ block('widget_choice_options') }} {% endif %} {% set options = choices %} - {{ block('options') }} + {{ block('widget_choice_options') }} {% endif %} {% endspaceless %} @@ -150,19 +150,19 @@ {% block checkbox_widget %} {% spaceless %} - + {% endspaceless %} {% endblock checkbox_widget %} {% block radio_widget %} {% spaceless %} - + {% endspaceless %} {% endblock radio_widget %} {% block datetime_widget %} {% spaceless %} -
+
{{ form_errors(form.date) }} {{ form_errors(form.time) }} {{ form_widget(form.date) }} @@ -176,7 +176,7 @@ {% if widget == 'single_text' %} {{ block('text_widget') }} {% else %} -
+
{{ date_pattern|replace({ '{{ year }}': form_widget(form.year), '{{ month }}': form_widget(form.month), @@ -189,7 +189,7 @@ {% block time_widget %} {% spaceless %} -
+
{{ form_widget(form.hour, { 'attr': { 'size': '1' } }) }}:{{ form_widget(form.minute, { 'attr': { 'size': '1' } }) }}{% if with_seconds %}:{{ form_widget(form.second, { 'attr': { 'size': '1' } }) }}{% endif %}
{% endspaceless %} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig index 30c06f2257..4d63441ac2 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig @@ -38,7 +38,7 @@ {% block form_widget %} {% spaceless %} - +
{{ block('field_rows') }} {{ form_rest(form) }}