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

No Bootstrap markup is rendered for label set as false#18504

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
jongotlin wants to merge1 commit intosymfony:2.7fromjongotlin:no-bootstrap-markup-for-empty-label
Closed

No Bootstrap markup is rendered for label set as false#18504

jongotlin wants to merge1 commit intosymfony:2.7fromjongotlin:no-bootstrap-markup-for-empty-label

Conversation

@jongotlin
Copy link
Contributor

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?-
Fixed tickets#18474
LicenseMIT
Doc PR

When using horizontal Bootstrap forms and setting'label' => false for a custom form type theform_row renders an ugly markup
screenshot 2016-04-11 13 48 25

This pr fixes that and make the form look like this
screenshot 2016-04-11 13 45 05

// FooType$builder    ->add('test','text')    ->add('foo',newBarType())    ->add('foo2',newBarType(), ['label' =>false]);
// BarType$builder->add('child','text');

<divclass="{{block('form_group_class') }}">
{{- form_widget(form) -}}
{{- form_errors(form) -}}
{%setdisplayMarkup=form.children|length==0orform.vars.labelis notsame as(false) %}
Copy link
Contributor

Choose a reason for hiding this comment

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

You should not change the behavior whenform.children|length == 0 imo.
This is not a bug, other templates show the label, and may be part of the work in progress feature in#17609.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I think it's a bug displaying aform-group inside aform-group. The label i still shown - the markup is not rendered when the label is set to false.
I cannot see how this will be solved in your pr. It looks like another feature.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I misread the condition, IIUC you force the label (evenfalse) to be printed when there is no child.
So I guess this should be right.

@fabpot
Copy link
Member

LGTM.

@jongotlin Can you add some tests to ensure that we don't break this again in the future?

@HeahDude
Copy link
Contributor

Ref#18850.

@soullivaneuh
Copy link
Contributor

@jongotlin Did you check your PR respect the second sample of#18850 (comment)?

->add('test', TextType::class, ['mapped' =>false,'label' =>false,'attr' => ['placeholder' =>'My label goes here',    ]])

image

@soullivaneuh
Copy link
Contributor

Also:

But in any case, this should not be handled like this IMHO but with acol-*-offset.

@soullivaneuh
Copy link
Contributor

This does not see my issue. I download your patch and tried with this form config:

publicfunctionbuildForm(FormBuilderInterface$builder,array$options){$builder        ->add('domain',null, ['label' =>'ssl_certificate.form.domain','translation_domain' =>'front',        ])        ->add('subdomains', CollectionType::class, ['label' =>'ssl_certificate.form.subdomains','translation_domain' =>'front','type' => TextType::class,'allow_add' =>true,'allow_delete' =>true,'prototype' =>true,'options' => ['label' =>false,'text_suffix' =>'','attr' => ['class' =>'subdomain-domain',                ],            ],        ])    ;}

Result:

image

This solve not this issue:#18850 (comment)

@soullivaneuh
Copy link
Contributor

Or the issue is not really related and in this case#18850 should be re-opened.

@soullivaneuh
Copy link
Contributor

Please see this alternative:#19247

@jongotlin
Copy link
ContributorAuthor

Thanks@soullivaneuh. I didn't think of the CollectionType-example you provided. I'll look into how it can be solved.

@jongotlin
Copy link
ContributorAuthor

Not sure how to solve@soullivaneuh s issue. I guess also the prototype is affected. Anyone having an idea where to start?

@soullivaneuh
Copy link
Contributor

@jongotlin I check vertical form, I have no issue about this at all.

The only solution I found is to correct the column classes in#19247.

@fabpot
Copy link
Member

Closing in favor of#19247

@fabpotfabpot closed thisJul 28, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@jongotlin@fabpot@HeahDude@soullivaneuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp