Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

alexander-schranz
Copy link
Contributor

@alexander-schranz alexander-schranz commented Apr 10, 2022

Q A
Branch? 6.1
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #...
License MIT
Doc PR symfony/symfony-docs#...

Add form_label_text and form_help_text block. When it is required to override the form_label block 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 a legend label the new form_label_content block can be used e.g.:

{%- block _custom_label -%}
    <legend>
        {{- block('form_label_content') -}}
    </legend>
{%- endblock -%}

The same I added for the form_help which also has some translation logic in it:

{%- block _custom_help -%}
    <div class="custom-help">
        {{- block('form_help_content') -}}
    </div>
{%- endblock -%}

Already the duplication of the logic in the bootstrap_4_layout theme can be avoided this way.

With the naming I was not sure first I had form_label_inner but thought that maybe form_label_content would better represent it.

@carsonbot carsonbot changed the title Add form_label_text and form_help_text block to form_div_layout [TwigBridge] Add form_label_text and form_help_text block to form_div_layout Apr 11, 2022
@alexander-schranz alexander-schranz force-pushed the feature/form-theme-text-block branch from 195078f to 70a19a6 Compare April 11, 2022 18:19
Copy link
Member

@javiereguiluz javiereguiluz left a 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 be form_label_content and form_help_content instead of form_*_text ?

@alexander-schranz alexander-schranz force-pushed the feature/form-theme-text-block branch 2 times, most recently from a4377ba to 31eb8b1 Compare April 26, 2022 20:37
@alexander-schranz alexander-schranz changed the title [TwigBridge] Add form_label_text and form_help_text block to form_div_layout [TwigBridge] Add form_label_content and form_help_content block to form_div_layout Apr 26, 2022
@alexander-schranz
Copy link
Contributor Author

@javiereguiluz like the suggestion did update it.

@alexander-schranz
Copy link
Contributor Author

Something missing here?

@@ -5,6 +5,7 @@ CHANGELOG
---

* Wrap help messages on form elements in `div` instead of `p`
* Add `form_label_content` and `form_help_content` block to form themes
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@chalasr chalasr force-pushed the feature/form-theme-text-block branch from 7adc456 to a40dbea Compare May 31, 2022 21:46
@chalasr
Copy link
Member

chalasr commented May 31, 2022

Thank you @alexander-schranz.

@chalasr chalasr merged commit d096349 into symfony:6.2 May 31, 2022
fabpot added a commit that referenced this pull request Oct 15, 2022
… 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 (see https://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 follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Adding the new block `form_label_content` for `bootstrap_5_layout.html.twig` to simplify it
Linked 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
symfony-splitter pushed a commit to symfony/twig-bridge that referenced this pull request Oct 15, 2022
… 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 (see https://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 follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Adding the new block `form_label_content` for `bootstrap_5_layout.html.twig` to simplify it
Linked 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
@fabpot fabpot mentioned this pull request Oct 24, 2022
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.

7 participants