Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverstripe CountryDropdownField-将默认值设置为setEmptyString()中设置的值?_Silverstripe - Fatal编程技术网

Silverstripe CountryDropdownField-将默认值设置为setEmptyString()中设置的值?

Silverstripe CountryDropdownField-将默认值设置为setEmptyString()中设置的值?,silverstripe,Silverstripe,我使用的是CountryDropdownField。我已经设置了空字符串。但它一直默认为美国。我如何使其默认为空字符串中设置的内容 $fields = new FieldList( CountryDropdownField::create('Country') ->setEmptyString('-- Please choose a country --') ); 将以下内容添加到mysite\u config\config.yml(然后确保运行dev/build

我使用的是
CountryDropdownField
。我已经设置了空字符串。但它一直默认为
美国
。我如何使其默认为空字符串中设置的内容

$fields = new FieldList(
    CountryDropdownField::create('Country')
        ->setEmptyString('-- Please choose a country --')
);

将以下内容添加到mysite\u config\config.yml(然后确保运行dev/build?full=1)以实现此目的

CountryDropdownField:
  default_to_locale: false
  default_country: ''

谢谢你,巴里。它不适合我使用SSv3.4.1。请给出_config.yml文件的确切路径,以改进您的答案。我在/mysite/_-config/config.yml和/mysite/_-config/_-config.yml中尝试了上述配置,但仍然得到了默认的选定国家/地区“美国”。我想改为第一个选项,即——从列表中选择国家——更新答案以确认确切的文件名,并提供提示以确保开发人员构建,对任何混淆表示歉意,因为这是所有ss开发人员在稍微使用框架后都应该硬连线的基本内容