misd-service-development / phone-number-bundle

Integrates libphonenumber into your Symfony2-Symfony4 application
459 stars 143 forks source link

placeholder for number #209

Closed webmasterMeyers closed 4 years ago

webmasterMeyers commented 4 years ago

Add "number_placeholder" option for PhoneNumberType::WIDGET_COUNTRY_CHOICE

Can be used like this

            ->add('primaryContactPhone', PhoneNumberType::class, [
                'widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE,
                'country_choices' => $this->countryRepository->getCodes(),
                'preferred_country_choices' => [$options['countryCode']],
                'number_placeholder' => $this->phoneNumberUtil->getExampleNumber($options['countryCode'])->getNationalNumber(),
            ])

provides a selected country with an example number.

webmasterMeyers commented 4 years ago

I have decided to go about this differently, closing this PR.