Skip to content

[Form] Add description of label_html option #13316

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

Merged
merged 1 commit into from
Mar 14, 2020

Conversation

przemyslaw-bogusz
Copy link
Contributor

@przemyslaw-bogusz przemyslaw-bogusz commented Mar 8, 2020

Q A
Feature PR symfony/symfony#31375
PR author(s) @przemyslaw-bogusz
Merged in WCM

@przemyslaw-bogusz przemyslaw-bogusz changed the title Add description of label_html option [WCM] Add description of label_html option Mar 8, 2020
@przemyslaw-bogusz przemyslaw-bogusz changed the title [WCM] Add description of label_html option [Form][WCM] Add description of label_html option Mar 8, 2020
@OskarStark OskarStark added the Waiting Code Merge Docs for features pending to be merged label Mar 9, 2020
@OskarStark OskarStark added this to the 5.1 milestone Mar 9, 2020
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Mar 12, 2020
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Form] Add label_html attribute

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT
| Doc PR        | symfony/symfony-docs#13316

I propose to add a new attribute to `BaseType` class so it is easy to include html tags in labels for, both, buttons and other elements that inherit from `FormType` class. This gives you an ability to add, e.g. a glyphicon to a button, or a link to a checkbox, simply inside the `FormBuilder`, which means you can just do
```twig
{{ form(form) }}
```
inside a template.

**Sidenotes**
1. I have started working on this two days ago and it the meantime @alexander-schranz made a similar proposition in #31358. If necessary, I can close my PR and @alexander-schranz can include my suggestions inside his PR.
1. I have just read in #29861 that @mpiot wanted to include this idea in his PR. With respect to @xabbuh's comments from that PR, I hope that my PR will be at least a good place to discuss, if the proposed feature is a good solution.

Commits
-------

239fe04 [Form] Add label_html attribute
symfony-splitter pushed a commit to symfony/form that referenced this pull request Mar 12, 2020
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Form] Add label_html attribute

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT
| Doc PR        | symfony/symfony-docs#13316

I propose to add a new attribute to `BaseType` class so it is easy to include html tags in labels for, both, buttons and other elements that inherit from `FormType` class. This gives you an ability to add, e.g. a glyphicon to a button, or a link to a checkbox, simply inside the `FormBuilder`, which means you can just do
```twig
{{ form(form) }}
```
inside a template.

**Sidenotes**
1. I have started working on this two days ago and it the meantime @alexander-schranz made a similar proposition in #31358. If necessary, I can close my PR and @alexander-schranz can include my suggestions inside his PR.
1. I have just read in #29861 that @mpiot wanted to include this idea in his PR. With respect to @xabbuh's comments from that PR, I hope that my PR will be at least a good place to discuss, if the proposed feature is a good solution.

Commits
-------

239fe04ff9 [Form] Add label_html attribute
@javiereguiluz javiereguiluz added Form Status: Reviewed and removed Waiting Code Merge Docs for features pending to be merged Status: Needs Review labels Mar 14, 2020
@javiereguiluz javiereguiluz changed the title [Form][WCM] Add description of label_html option [Form] Add description of label_html option Mar 14, 2020
@javiereguiluz javiereguiluz merged commit e0d1516 into symfony:master Mar 14, 2020
@javiereguiluz
Copy link
Member

@przemyslaw-bogusz thanks! We added the missing versionadded directive while merging.

@przemyslaw-bogusz
Copy link
Contributor Author

Thanks, I will try to remember about it next time.

@przemyslaw-bogusz przemyslaw-bogusz deleted the label_html branch March 14, 2020 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants