Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added option for not displaying a form-label by setting label to false. #5421

Closed
wants to merge 2 commits into from

4 participants

@BenjaminBeck

....twig

Option for not displaying a label by setting label to false.

BenjaminBeck added some commits
@BenjaminBeck BenjaminBeck Update src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.h…
…tml.twig

Option for not displaying a label by setting label to false.
07a111e
@BenjaminBeck BenjaminBeck Update src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.h…
…tml.twig

Fixed formatting & translation ..
9a06f29
@travisbot

This pull request fails (merged 07a111e into 41ffd00).

@stof
Collaborator

The same should be done for the PHP rendering

@stof
Collaborator

and this is breaking a lots of tests

@travisbot

This pull request passes (merged 9a06f29 into 41ffd00).

@stof
Collaborator

@BenjaminBeck can you update this PR to implement the feature in the PHP templates too ?

@BenjaminBeck

@stof yes, i´ll do it. Can you please tell me where i can find the PHP templates?

@stof
Collaborator

in FrameworkBundle

@fabpot
Owner

@BenjaminBeck Do you have time to finish this PR?

@BenjaminBeck

@fabpot Sorry, in the next 2-3 weeks i will have no time to finish it.

@stof
Collaborator

closed in favor of #6262

@stof stof closed this
@fabpot fabpot referenced this pull request from a commit
@fabpot fabpot merged branch stloyd/feature/form-labels (PR #6262)
This PR was merged into the master branch.

Commits
-------

d5426f0 [Form] Add tests to prove that label is not rendered when is marked as false
120547c [Form][TwigBridge] Don't set label attributes if is marked as not to be rendered [Form][FrameworkBundle] Add option to disable rendering of label for fields
36e4556 [Form] Option for not displaying a label by setting label to false. [Form] Fixed formatting & translation ..

Discussion
----------

[Form] Added option for not displaying a form-label by setting label to false

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Replaces: #5421

@fabpot @BenjaminBeck: I was just not sure what to do with "table based" forms, so I left `<td></td>` rendered when there is no label, because I'm not sure that we can hide it easily.

---------------------------------------------------------------------------

by XWB at 2012-12-11T09:30:14Z

:+1:
2578f1e
@mmucklo mmucklo referenced this pull request from a commit
@fabpot fabpot merged branch stloyd/feature/form-labels (PR #6262)
This PR was merged into the master branch.

Commits
-------

d5426f0 [Form] Add tests to prove that label is not rendered when is marked as false
120547c [Form][TwigBridge] Don't set label attributes if is marked as not to be rendered [Form][FrameworkBundle] Add option to disable rendering of label for fields
36e4556 [Form] Option for not displaying a label by setting label to false. [Form] Fixed formatting & translation ..

Discussion
----------

[Form] Added option for not displaying a form-label by setting label to false

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Replaces: #5421

@fabpot @BenjaminBeck: I was just not sure what to do with "table based" forms, so I left `<td></td>` rendered when there is no label, because I'm not sure that we can hide it easily.

---------------------------------------------------------------------------

by XWB at 2012-12-11T09:30:14Z

:+1:
ae0cb32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 3, 2012
  1. @BenjaminBeck

    Update src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.h…

    BenjaminBeck authored
    …tml.twig
    
    Option for not displaying a label by setting label to false.
  2. @BenjaminBeck

    Update src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.h…

    BenjaminBeck authored
    …tml.twig
    
    Fixed formatting & translation ..
This page is out of date. Refresh to see the latest.
View
8 src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
@@ -227,10 +227,12 @@
{% if required %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
{% endif %}
- {% if label is empty %}
- {% set label = name|humanize %}
+ {% if label is not sameas(false) %}
+ {% if label is empty %}
+ {% set label = name|humanize %}
+ {% endif %}
+ <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ label|trans({}, translation_domain) }}</label>
{% endif %}
- <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ label|trans({}, translation_domain) }}</label>
{% endspaceless %}
{% endblock form_label %}
Something went wrong with that request. Please try again.