Skip to content

[Form] Incorrect description for choice_attr option of ChoiceType field #6443

Closed
@mvar

Description

@mvar

Current choice_attr description:

Use this to add additional HTML attributes to each choice. This can be an array of attributes (if they are the same for each choice), a callable or a property path (just like choice_label).

Actually it's not possible to set attributes for all choices at once. You need to redefine attributes for each choice separately:

'choice_attr' => [
    'Choice A' => ['class' => 'foo'],
    'Choice B' => ['class' => 'foo'],
    ...
    'Choice Z' => ['class' => 'foo'],
],

Please correct me if I'm wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions