odolbeau / phone-number-bundle

Integrates libphonenumber into your Symfony application
MIT License
215 stars 43 forks source link

Add option to allow display of the flag in the form widget #152

Closed DesLynx closed 11 months ago

DesLynx commented 1 year ago

Provides a solution for https://github.com/odolbeau/phone-number-bundle/issues/105

Nek- commented 1 year ago

Hello @DesLynx , thank you very much for this contribution! It looks interesting. However please share with us why, how, and also some screen of how it looks. (any details will help us decide if yes or no we are going to use it).

It also adds a new extension as the requirement... I think mbstring is probably installed everywhere by default, but we should consider this anyway.

DesLynx commented 1 year ago

Hi! Why: it provides a better look and feel. With no extra CSS nor Javascript. How: it uses emojis.

Note: I removed the requirement for the mbstring extension as giggsey/libphonenumber-for-php already requires the symfony/polyfill-mbstring.

Here is a screenshot (in Firefox) for this config:

$form = $this->createFormBuilder($obj)
    ->add('phone', PhoneNumberType::class, [
        'label'                      => 'Phone number',
        'required'                   => true,
        'widget'                     => PhoneNumberType::WIDGET_COUNTRY_CHOICE,
        'country_choices'            => [],
        'preferred_country_choices'  => ['FR', 'CH', 'BE', 'LU'],
        'country_display_emoji_flag' => true,
    ])
    ->getForm();

image

Nek- commented 1 year ago

@DesLynx thanks for the details, however, we need to add the symfony/polyfill-mbstring as well in this case.

maxhelias commented 11 months ago

Thanks @DesLynx !

DesLynx commented 11 months ago

Hi! I noticed that you haven't created a new tag for the repo since merging the PR. As it adds the info about the new option country_display_emoji_flag in the README this can be confusing for the users...