10000 Don't reserve space for label when there is no label · Issue #18850 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Don't reserve space for label when there is no label #18850

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

Closed
flip111 opened this issue May 23, 2016 · 2 comments
Closed

Don't reserve space for label when there is no label #18850

flip111 opened this issue May 23, 2016 · 2 comments
Labels

Comments

@flip111
Copy link
Contributor
flip111 commented May 23, 2016

In this code a div is taking up space with no contents. I understand that if there are siblings with a label you want to align them. But often you have either no labels at all or everything has a label. Some logic could be introduced here to look at siblings.

@xabbuh xabbuh added the Form label May 23, 2016
@soullivaneuh
Copy link
Contributor
soullivaneuh commented Jun 29, 2016

I think both case should be handled.

For me, with the following collection type:

public function buildForm(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',
                ],
            ],
        ])
    ;
}

I get this:

image

This is useless and related to @flip111 link.

But I also agree that in some case this "no content" space can be useful to keep form alignement.

Example:

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

image

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

@HeahDude
Copy link
Contributor

Duplicate of #18474, see #18504.

This should be handled globally not only for bootstrap horizontal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
0