Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Form] Automated label generation for forms#11456

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

Closed
alexandresalome wants to merge4 commits intosymfony:masterfromalexandresalome:form-autolabel
Closed

[Form] Automated label generation for forms#11456

alexandresalome wants to merge4 commits intosymfony:masterfromalexandresalome:form-autolabel

Conversation

@alexandresalome
Copy link

QA
Bug fix?[no]
New feature?[yes]
BC breaks?[no]
Deprecations?[no]
Tests pass?TBD
Fixed ticketsNot a fix, but discussed in#11298
LicenseMIT
Doc PRTBD
standard edition PRTBD

Discussion started in#11298

This PR is about adding an option to automate the label generation for forms:

# app/config/config.ymlframework:form:# auto_label: ~                      # enable the extension# auto_label: form.%%type%%.%%name%% # set the auto_label globally, but allow overriding per form

This option would be useful for big I18Ned applications with standardized label form translations. We could also add an option for a defaulttranslation_domain.

form:translation_domain:"form"

I started this work as a third-party extension, because most applications don't need it, so the footprint is null for them.

What is your advice on it?

  • Inherit auto-label from parent
  • Create the documentation PR
  • Create the standard edition PR

Copy link
Member

Choose a reason for hiding this comment

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

Should benull === $options['label'] (also in the expressions below).

@alexandresalome
Copy link
Author

@webmozart do you agree on the implementation? I'll work on documentation PRs as soon as the implementation is validated here

@webda2l
Copy link
Contributor

Seehttps://github.com/Elao/ElaoFormTranslationBundle if you don't know already it.
This is a nice implementation.

Copy link
Member

Choose a reason for hiding this comment

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

the parameter name looks weird withauto_label being duplicated.form.type_extension.auto_label.format might be better

@webmozart
Copy link
Contributor

Thanks for the idea and PR@alexandresalome! I had a little different solution in mind, which I uploaded in#12050. Please let me know whether this is convenient for you.

Cheers!

webmozart added a commit that referenced this pull requestSep 30, 2014
This PR was merged into the 2.6-dev branch.Discussion----------[Form] Added "label_format" option| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#11456| License       | MIT| Doc PR        | TODOThis PR replaces#11456. It adds a "label_format" option which allows to configure a format for generating labels. Two placeholders are available: `%name%` and `%id%`.**Feedback wanted**: Should we change the placeholders to `{{ name }}` and `{{ id }}`?The option is inherited from the parent form if not set explicitly on a field:```php$form = $this->createForm('myform', $data, array('label_format' => 'form.label.%id%'));```Follow-up PR: Make the default label format and translation domain configurable in config.yml.Commits-------aad442d [Form] Added "label_format" option
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@alexandresalome@webda2l@webmozart@stof@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp