Skip to content

Conversation

@webmasterMeyers
Copy link

pass options to the number input when using PhoneNumberType::WIDGET_COUNTRY_CHOICE
use like,

$builder->add('primaryContactPhone', PhoneNumberType::class, [
    'widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE,
    'country_choices' => $this->countryRepository->getCodes(),
    'preferred_country_choices' => [$options['countryCodes']],
    'number_options' => [
        'attr' => [
            'class' => 'js-phone-autocomplete',
            'data-autocomplete-url' => $this->router->generate('grid_api_contact_phone_get_matching'),
            'placeholder' => $this->phoneNumberUtil->getExampleNumber($options['countryCodes'])->getNationalNumber(),
        ],
    ],
])

Nek- pushed a commit to Nek-/phone-number-bundle that referenced this pull request Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant