Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Nov 12, 2023

Conversation

DesLynx
Copy link

@DesLynx DesLynx commented Aug 22, 2023

Provides a solution for #105

@Nek-
Copy link
Collaborator

Nek- commented Aug 25, 2023

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
Copy link
Author

DesLynx commented Aug 28, 2023

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

Copy link
Owner

@odolbeau odolbeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really great for me! 👌

@Nek-
Copy link
Collaborator

Nek- commented Aug 29, 2023

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

README.md Show resolved Hide resolved
@DesLynx DesLynx requested a review from Nek- August 29, 2023 14:09
@maxhelias maxhelias merged commit f4a5d9f into odolbeau:master Nov 12, 2023
@maxhelias
Copy link
Collaborator

Thanks @DesLynx !

@DesLynx
Copy link
Author

DesLynx commented Nov 16, 2023

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...

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.

4 participants