简体   繁体   English

如何在Drupal Commerce中从国家/地区代码获取国家/地区名称

[英]How to get country name from country code in Drupal Commerce

I get the country code from field_data_commerce_customer_address table in drupal commerce. 我从drupal field_data_commerce_customer_address表中获取国家/地区代码。 Now how to get the full country name from this code. 现在如何从此代码获取完整的国家名称。

You can use drupal cores country manager like this : 您可以像这样使用drupal cores区域经理:

$country_list = \Drupal::getContainer()->get('country_manager')->getList();
$country_name = $country_list[$country_code]->render();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM