- Issue created by @nikhil_dawar
- 🇮🇳India Shubham_Kumar
I've developed a patch to hide the flag linked to the phone number field. With this patch, no additional configurations are required.
- 🇮🇳India Shubham_Kumar
I've noticed an additional requirement. According to your specifications, a configuration field is needed to control the visibility of the flag icon. Accordingly, I've created a patch that allows for the convenient hiding or displaying of the flag icon. To hide the flag icon, you can enable the "Disable Flag field" option in the phone element. From Your form build Settings
- First commit to issue fork.
- Merge request !15Issue #3403595: Display Or Hide Flag with Country Code → (Merged) created by mahtab_alam
- Open on Drupal.org →Core: 10.1.4 + Environment: PHP 8.1 & MySQL 8last update
12 months ago Waiting for branch to pass - Status changed to Needs review
12 months ago 10:33am 2 January 2024 - Open on Drupal.org →Core: 10.1.4 + Environment: PHP 8.1 & MySQL 8last update
12 months ago Waiting for branch to pass - First commit to issue fork.
- Open on Drupal.org →Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8last update
10 months ago Waiting for branch to pass - Issue was unassigned.
- 🇷🇸Serbia vaish
Commit in #15 improves upon the previous version in several ways.
1. Just hiding flag creates ambiguous situation for calling code +1 which is used by multiple countries. It's not possible to know which country is actually selected by looking at the country calling code alone. To solve this issue, the new commit displays two-letter country code when the flag is hidden.
2. Previous version was incomplete, it was covering only webform element but not regular Drupal core field. New commit adds the following missing features:
- implement "Country selection" field widget setting with two options: "Flag" and "Two letter country code".
- add new setting to the field schema
- webform element: move "Country selection" setting into the Phone number settings fieldset for better usability.
- add tests for the new feature
3. This MR also includes fix for the failed phpunit test
FunctionalJavascript\SelectCountryTest::testCountrySelect()
. Failure was caused by a change introduced in Drupal 10.2. For details see comment #121 in Drupal core issue 📌 Stabilize FunctionalJavascript testing AJAX: add ::assertExpectedAjaxRequest() Fixed . In this particular case usage ofassertWaitOnAjaxRequest()
was not needed.4. Since I was already working in this area, I also did some clean up of inefficient JavaScript code in
setCountry()
function.- I chained removeClass() and addClass() methods. Previously code was doing two independent tree traversals.
- I removed unnecessary for loop that was going through all the options in Country select list in order to find the selected one. Selected option can be accessed directly without the loop.
Form display
Field widget settings
Webform element configuration
- Status changed to RTBC
9 months ago 10:31pm 13 March 2024 - 🇺🇸United States chrisolof
Excellent improvements here. The current state of the MR seems to work well and does not appear to be disruptive to existing installations.
Thanks everyone! - Open on Drupal.org →Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8last update
9 months ago Waiting for branch to pass -
vaish →
committed 376f2289 on 2.0.x authored by
mahtab_alam →
Issue #3403595 by Shubham_Kumar, vaish, nikhil_dawar: Add setting to...
-
vaish →
committed 376f2289 on 2.0.x authored by
mahtab_alam →
- Status changed to Fixed
9 months ago 11:40am 18 March 2024 Automatically closed - issue fixed for 2 weeks with no activity.