hellonico/acf-country
Composer 安装命令:
composer require hellonico/acf-country
包简介
A country field for ACF.
README 文档
README
Adds a 'Country' field type for the Advanced Custom Fields WordPress plugin.
⚠️ WARNING ⚠️
From version 2.0.0, ACF Country introduced some important breaking changes:
- Dropped support for older PHP & ACF versions, new requirements are:
- ACF 5.7+
- PHP 5.4+
- Return format has changed. To better stick to ACF and make use of ACF functions, ACF Country will now return values the same way select field do.
['FR' => 'France']will now look like['label' => 'France', 'value' => 'FR']
Looking for a ACF pre 5.7 support? Check the 1.0 branch.
Overview
Display a select list of all countries in your language.
Country names are available in every language (see available list). By default, country names are localized in your current WordPress language.
Select a single value:
Or multiple ones:
Compatibility
- ACF 5.7+
- PHP 5.4+
Field options
| Option | Default | Description |
|---|---|---|
| Default value | emtpy | Set a default value for the country field (as country code) |
| Allow null | false |
Enable/disable null value |
| Allow multiple | false |
Enable/disable multiple countries selection |
| Stylised UI | true |
Enable/disable enhanced select field thanks to Select2 |
| Return format | value |
See ACF Select field |
Filters
You can remove (or add) some countries with the acf/country/countries filter, example:
add_filter( 'acf/country/countries', function( $countries ) { return array_filter( $countries, function( $code ) { return !in_array( $code, ['IC', 'EA'], true ); }, ARRAY_FILTER_USE_KEY); } );
Note: PHP5.6+ example
Installation
Zip
Download the plugin and extract the archive to your plugins folder.
Composer
composer require hellonico/acf-country
Contributing
See CONTRIBUTING.
Support
This ACF field was originally developed for a personal project I don't use anymore. I still decided to maintain it anyway. If you use it in a commercial project, please consider buying me a beer.
hellonico/acf-country 适用场景与选型建议
hellonico/acf-country 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 96.16k 次下载、GitHub Stars 达 121, 最近一次更新时间为 2017 年 01 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「country」 「wordpress-plugin」 「acf」 「advanced custom fields」 「acf-field」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hellonico/acf-country 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hellonico/acf-country 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hellonico/acf-country 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Sun Country is the package that helps you to get the country name & dialing code by the country ISO 3166-1 Alpha-2 code.
List of all countries with names and ISO 3166-1 codes in all languages and data formats for Laravel
Country select field type.
Country Flag Emoji for PHP
Check for holidays - localeaware
Metamel Addresses is a polymorphic Laravel package, for address book management. You can add addresses to any eloquent model with ease.
统计信息
- 总下载量: 96.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 121
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2017-01-08

