Skip to content

Commit 0b34753

Browse files
committed
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:
2 parents e9c1443 + 8809038 commit 0b34753

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
<?php if (false !== $label): ?>
12
<?php if ($required) { $label_attr['class'] = trim((isset($label_attr['class']) ? $label_attr['class'] : '').' required'); } ?>
23
<?php if (!$compound) { $label_attr['for'] = $id; } ?>
34
<?php if (!$label) { $label = $view['form']->humanize($name); } ?>
45
<label <?php foreach ($label_attr as $k => $v) { printf('%s="%s" ', $view->escape($k), $view->escape($v)); } ?>><?php echo $view->escape($view['translator']->trans($label, array(), $translation_domain)) ?></label>
6+
<?php endif ?>

0 commit comments

Comments
 (0)