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

[5.x]: Add option to output country name in addition to country code in Craft CMS #15455

Closed
alexanderbuergin opened this issue Aug 1, 2024 · 2 comments
Labels

Comments

@alexanderbuergin
Copy link

alexanderbuergin commented Aug 1, 2024

Description:

Currently, the Country Field in Craft CMS only allows for the country code to be output, for example, "AT" for Austria. It would be beneficial to have an option to output the country name, such as "Austria", similar to how other select fields operate, where you can output different values in the template.

In the same vein, it would be practical to extend this option to the country field in the normal address fields as well.

Proposal:

The implementation could look as follows:

entry.country -> entry.country.code (default)
entry.country.name
entry.country.code

The values would be based on the ISO-3166-1 coding list.

This enhancement would significantly improve the usability and flexibility of the Country Field in Craft CMS.

Feel free to modify it further if needed.

Craft CMS version

5.2

@brandonkelly
Copy link
Member

brandonkelly commented Aug 2, 2024

Thanks for the suggestion! Made both of those changes for Craft 4.11 and 5.3 (#15463).

@alexanderbuergin
Copy link
Author

@brandonkelly Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants