Skip to content

[Form] Added choice_filter option #10413

Closed
@ro0NL

Description

@ro0NL

see symfony/symfony#28624

$supportedCountries = ['NL', 'FR', 'DE'];

$builder->add('country', CountryType::class, [
    'choice_filter' => function ($countryName) use ($supportedCountries) {
        return in_array($countryName, $supportedCountries, true);
    }),
]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions