8000 [Fomr] Added label option to Form fields by Seldaek · Pull Request #69 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Fomr] Added label option to Form fields #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Form][TwigBundle] Make use of the new label option when rendering forms
  • Loading branch information
Seldaek committed Feb 21, 2011
commit c14f9dac044cd3e3c4012ac051fa0b02e1b1a4d2
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/TwigBundle/Extension/FormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function renderLabel(FieldInterface $field, $label = null, array $paramet
return $this->render($field, 'label', array(
'field' => $field,
'params' => $parameters,
'label' => null !== $label ? $label : ucfirst(strtolower(str_replace('_', ' ', $field->getKey()))),
'label' => null !== $label ? $label : $field->getLabel(),
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function getName()
*/
public function getLabel()
{
return $this->getOption('label') ?: $this->key;
return $this->getOption('label') ?: ucfirst(strtolower(str_replace('_', ' ', $this->key)));
}

/**
Expand Down
0