Skip to content

[Twig, Form Types] Form text field placeholder can not be null. Why? #37573

@dawsza

Description

@dawsza

Symfony version(s) affected: 5.1.2

Description
Form input placeholder can be empty string or false but can not be null. Why?
Another attributes like for example class can by null.

Error: Argument 1 passed to Symfony\Bridge\Twig\Extension\TranslationExtension::trans() must be of the type string, null given

How to reproduce

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name', null, ['attr' => [
                'placeholder'   => null,
            ]])
        ;
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy