Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[TwigBridge] Add form_label_content and form_help_content block to form_div_layout#45985
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[TwigBridge] Add form_label_content and form_help_content block to form_div_layout#45985
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
195078f to70a19a6CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
A very minor comment: given that both label and help messages can contain HTML tags and even images (icons, etc.) should the proposed block names beform_label_content andform_help_content instead ofform_*_text ?
a4377ba to31eb8b1Compare@javiereguiluz like the suggestion did update it. |
Something missing here? |
src/Symfony/Bridge/Twig/CHANGELOG.md Outdated
| --- | ||
| * Wrap help messages on form elements in`div` instead of`p` | ||
| * Add`form_label_content` and`form_help_content` block to form themes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you please move this to a new 6.2 section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
done
7adc456 toa40dbeaCompareThank you@alexander-schranz. |
… bootstrap 5 layout (Yoann-TYT)This PR was merged into the 6.2 branch.Discussion----------[TwigBridge] Adding the new block form_label_content for bootstrap 5 layout| Q | A| ------------- | ---| Branch? | 6.2| Bug fix? | no| New feature? | no| Deprecations? | no| Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->| License | MIT| Doc PR | symfony/symfony-docs#... <!-- required for new features --><!--Replace this notice by a short README for your feature/bugfix.This will help reviewers and should be a good start for the documentation.Additionally (seehttps://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should followhttps://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (seehttps://symfony.com/bc).-->Adding the new block `form_label_content` for `bootstrap_5_layout.html.twig` to simplify itLinked to [[TwigBridge] Add form_label_content and form_help_content block to form_div_layout](#45985)Commits-------c2b9bec adding the new block form_label_content for bootstrap_5_layout.html.twig to simplify it
… bootstrap 5 layout (Yoann-TYT)This PR was merged into the 6.2 branch.Discussion----------[TwigBridge] Adding the new block form_label_content for bootstrap 5 layout| Q | A| ------------- | ---| Branch? | 6.2| Bug fix? | no| New feature? | no| Deprecations? | no| Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->| License | MIT| Doc PR | symfony/symfony-docs#... <!-- required for new features --><!--Replace this notice by a short README for your feature/bugfix.This will help reviewers and should be a good start for the documentation.Additionally (seehttps://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should followhttps://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (seehttps://symfony.com/bc).-->Adding the new block `form_label_content` for `bootstrap_5_layout.html.twig` to simplify itLinked to [[TwigBridge] Add form_label_content and form_help_content block to form_div_layout](symfony/symfony#45985)Commits-------c2b9becda4 adding the new block form_label_content for bootstrap_5_layout.html.twig to simplify it
Uh oh!
There was an error while loading.Please reload this page.
Add form_label_text and form_help_text block. When it is required to override the
form_labelblock a lot uf logic need to be duplicated which is just the translation logic of the label. To make the things easier e.g. when creating alegendlabel the newform_label_contentblock can be used e.g.:{%-block_custom_label -%} <legend> {{-block('form_label_content') -}} </legend>{%-endblock -%}The same I added for the
form_helpwhich also has some translation logic in it:{%-block_custom_help -%} <divclass="custom-help"> {{-block('form_help_content') -}} </div>{%-endblock -%}Already the duplication of the logic in the
bootstrap_4_layouttheme can be avoided this way.With the naming I was not sure first I had
form_label_innerbut thought that maybeform_label_contentwould better represent it.