func TestGroupSliceMerge(t *testing.T) { tests := []struct { have []*config.Group wantErr error want string }{ { have: []*config.Group{ &config.Group{ ID: "b", Fields: config.FieldSlice{ &config.Field{ID: "c", Default: `c`, Type: config.TypeMultiselect}, }, }, &config.Group{ ID: "b", Fields: config.FieldSlice{ &config.Field{ID: "d", Default: `d`, Comment: "Ring of fire", Type: config.TypeObscure}, &config.Field{ID: "c", Default: `haha`, Type: config.TypeSelect, Scope: config.NewScopePerm(config.ScopeDefaultID, config.ScopeWebsiteID)}, }, }, &config.Group{ ID: "b", Fields: config.FieldSlice{ &config.Field{ID: "d", Default: `overriddenD`, Label: "Sect2Group2Label4", Comment: "LOTR"}, &config.Field{ID: "c", Default: `overriddenHaha`, Type: config.TypeHidden}, }, }, }, wantErr: nil, want: `[{"ID":"b","Fields":[{"ID":"c","Type":"hidden","Scope":["ScopeDefault","ScopeWebsite"],"Default":"overriddenHaha"},{"ID":"d","Type":"obscure","Label":"Sect2Group2Label4","Comment":"LOTR","Default":"overriddenD"}]}]` + "\n", }, { have: nil, wantErr: nil, want: `null` + "\n", }, } for i, test := range tests { var baseGsl config.GroupSlice haveErr := baseGsl.Merge(test.have...) if test.wantErr != nil { assert.Len(t, baseGsl, 0) assert.Error(t, haveErr) assert.Contains(t, haveErr.Error(), test.wantErr) } else { assert.NoError(t, haveErr) j := baseGsl.ToJSON() if j != test.want { t.Errorf("\nIndex: %d\nExpected: %s\nActual: %s\n", i, test.want, j) } } } }
func init() { PackageConfiguration = config.NewConfiguration( &config.Section{ ID: "general", Label: "General", SortOrder: 10, Scope: config.ScopePermAll, Groups: config.GroupSlice{ &config.Group{ ID: "single_store_mode", Label: `Single-Store Mode`, Comment: ``, SortOrder: 150, Scope: config.NewScopePerm(config.ScopeDefaultID), Fields: config.FieldSlice{ &config.Field{ // Path: `general/single_store_mode/enabled`, ID: "enabled", Label: `Enable Single-Store Mode`, Comment: `This setting will not be taken into account if system has more than one store view.`, Type: config.TypeSelect, SortOrder: 10, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID), Default: nil, BackendModel: nil, SourceModel: nil, // Magento\Config\Model\Config\Source\Yesno }, }, }, &config.Group{ ID: "store_information", Label: `Store Information`, Comment: ``, SortOrder: 100, Scope: config.ScopePermAll, Fields: config.FieldSlice{ &config.Field{ // Path: `general/store_information/name`, ID: "name", Label: `Store Name`, Comment: ``, Type: config.TypeText, SortOrder: 10, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, SourceModel: nil, }, &config.Field{ // Path: `general/store_information/phone`, ID: "phone", Label: `Store Phone Number`, Comment: ``, Type: config.TypeText, SortOrder: 20, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, SourceModel: nil, }, }, }, }, }, &config.Section{ ID: "web", Label: "Web", SortOrder: 20, Scope: config.ScopePermAll, Groups: config.GroupSlice{ &config.Group{ ID: "url", Label: `Url Options`, Comment: ``, SortOrder: 3, Scope: config.NewScopePerm(config.ScopeDefaultID), Fields: config.FieldSlice{ &config.Field{ // Path: `web/url/use_store`, ID: "use_store", Label: `Add Store Code to Urls`, Comment: `<strong style="color:red">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).`, Type: config.TypeSelect, SortOrder: 10, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID), Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Store SourceModel: nil, // Magento\Config\Model\Config\Source\Yesno }, &config.Field{ // Path: `web/url/redirect_to_base`, ID: "redirect_to_base", Label: `Auto-redirect to Base URL`, Comment: `I.e. redirect from http://example.com/store/ to http://www.example.com/store/`, Type: config.TypeSelect, SortOrder: 20, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID), Default: nil, BackendModel: nil, SourceModel: nil, // Magento\Config\Model\Config\Source\Web\Redirect }, }, }, &config.Group{ ID: "unsecure", Label: `Base URLs`, Comment: `Any of the fields allow fully qualified URLs that end with '/' (slash) e.g. http://example.com/magento/`, SortOrder: 10, Scope: config.ScopePermAll, Fields: config.FieldSlice{ &config.Field{ // Path: `web/unsecure/base_url`, ID: "base_url", Label: `Base URL`, Comment: `Specify URL or {{base_url}} placeholder.`, Type: config.TypeText, SortOrder: 10, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Baseurl SourceModel: nil, }, &config.Field{ // Path: `web/unsecure/base_link_url`, ID: "base_link_url", Label: `Base Link URL`, Comment: `May start with {{unsecure_base_url}} placeholder.`, Type: config.TypeText, SortOrder: 20, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Baseurl SourceModel: nil, }, &config.Field{ // Path: `web/unsecure/base_static_url`, ID: "base_static_url", Label: `Base URL for Static View Files`, Comment: `May be empty or start with {{unsecure_base_url}} placeholder.`, Type: config.TypeText, SortOrder: 25, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Baseurl SourceModel: nil, }, &config.Field{ // Path: `web/unsecure/base_media_url`, ID: "base_media_url", Label: `Base URL for User Media Files`, Comment: `May be empty or start with {{unsecure_base_url}} placeholder.`, Type: config.TypeText, SortOrder: 40, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Baseurl SourceModel: nil, }, }, }, &config.Group{ ID: "secure", Label: `Base URLs (Secure)`, Comment: `Any of the fields allow fully qualified URLs that end with '/' (slash) e.g. https://example.com/magento/`, SortOrder: 20, Scope: config.ScopePermAll, Fields: config.FieldSlice{ &config.Field{ // Path: `web/secure/base_url`, ID: "base_url", Label: `Secure Base URL`, Comment: `Specify URL or {{base_url}}, or {{unsecure_base_url}} placeholder.`, Type: config.TypeText, SortOrder: 10, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Baseurl SourceModel: nil, }, &config.Field{ // Path: `web/secure/base_link_url`, ID: "base_link_url", Label: `Secure Base Link URL`, Comment: `May start with {{secure_base_url}} or {{unsecure_base_url}} placeholder.`, Type: config.TypeText, SortOrder: 20, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Baseurl SourceModel: nil, }, &config.Field{ // Path: `web/secure/base_static_url`, ID: "base_static_url", Label: `Secure Base URL for Static View Files`, Comment: `May be empty or start with {{secure_base_url}}, or {{unsecure_base_url}} placeholder.`, Type: config.TypeText, SortOrder: 25, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Baseurl SourceModel: nil, }, &config.Field{ // Path: `web/secure/base_media_url`, ID: "base_media_url", Label: `Secure Base URL for User Media Files`, Comment: `May be empty or start with {{secure_base_url}}, or {{unsecure_base_url}} placeholder.`, Type: config.TypeText, SortOrder: 40, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Baseurl SourceModel: nil, }, &config.Field{ // Path: `web/secure/use_in_frontend`, ID: "use_in_frontend", Label: `Use Secure URLs in Frontend`, Comment: `Enter https protocol to use Secure URLs in Frontend.`, Type: config.TypeSelect, SortOrder: 50, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Secure SourceModel: nil, // Magento\Config\Model\Config\Source\Yesno }, &config.Field{ // Path: `web/secure/use_in_adminhtml`, ID: "use_in_adminhtml", Label: `Use Secure URLs in Admin`, Comment: `Enter https protocol to use Secure URLs in Admin.`, Type: config.TypeSelect, SortOrder: 60, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID), Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Secure SourceModel: nil, // Magento\Config\Model\Config\Source\Yesno }, &config.Field{ // Path: `web/secure/offloader_header`, ID: "offloader_header", Label: `Offloader header`, Comment: ``, Type: config.TypeText, SortOrder: 70, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID), Default: nil, BackendModel: nil, SourceModel: nil, }, }, }, }, }, &config.Section{ ID: "catalog", Groups: config.GroupSlice{ &config.Group{ ID: "price", Fields: config.FieldSlice{ &config.Field{ // Path: `catalog/price/scope`, ID: "scope", Default: PriceScopeGlobal, }, }, }, }, }, ) }
Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Theme\Model\Design\Backend\Theme SourceModel: nil, // Magento\Framework\View\Design\Theme\Label::getLabelsCollectionForSystemConfiguration }, &config.Field{ // Path: `design/theme/ua_regexp`, ID: "ua_regexp", Label: `User-Agent Exceptions`, Comment: `Search strings are either normal strings or regular exceptions (PCRE). They are matched in the same order as entered. Examples:<br /><span style="font-family:monospace">Firefox<br />/^mozilla/i</span>`, Type: config.TypeText, SortOrder: 2, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID, config.ScopeWebsiteID), Default: nil, BackendModel: nil, // Magento\Theme\Model\Design\Backend\Exceptions SourceModel: nil, }, }, }, &config.Group{ ID: "pagination", Label: `Pagination`, Comment: ``, SortOrder: 500, Scope: config.ScopePermAll, Fields: config.FieldSlice{ &config.Field{
func TestSectionSliceMerge(t *testing.T) { // Got stuck in comparing JSON? // Use a Webservice to compare the JSON output! tests := []struct { have []config.SectionSlice wantErr string want string wantLen int }{ 0: { have: []config.SectionSlice{ nil, config.SectionSlice{ nil, &config.Section{ ID: "a", Groups: config.GroupSlice{ nil, &config.Group{ ID: "b", Fields: config.FieldSlice{ &config.Field{ID: "c", Default: `c`}, }, }, &config.Group{ ID: "b", Fields: config.FieldSlice{ &config.Field{ID: "d", Default: `d`}, }, }, }, }, }, config.SectionSlice{ &config.Section{ID: "a", Label: "LabelA", Groups: nil}, }, }, wantErr: "", want: `[{"ID":"a","Label":"LabelA","Groups":[{"ID":"b","Fields":[{"ID":"c","Default":"c"},{"ID":"d","Default":"d"}]}]}]` + "\n", wantLen: 2, }, 1: { have: []config.SectionSlice{ config.SectionSlice{ &config.Section{ ID: "a", Label: "SectionLabelA", Groups: config.GroupSlice{ &config.Group{ ID: "b", Scope: config.NewScopePerm(config.ScopeDefaultID), Fields: config.FieldSlice{ &config.Field{ID: "c", Default: `c`}, }, }, nil, }, }, }, config.SectionSlice{ &config.Section{ ID: "a", Scope: config.NewScopePerm(config.ScopeDefaultID, config.ScopeWebsiteID), Groups: config.GroupSlice{ &config.Group{ID: "b", Label: "GroupLabelB1"}, nil, &config.Group{ID: "b", Label: "GroupLabelB2"}, &config.Group{ ID: "b2", Fields: config.FieldSlice{ &config.Field{ID: "d", Default: `d`}, }, }, }, }, }, }, wantErr: "", want: `[{"ID":"a","Label":"SectionLabelA","Scope":["ScopeDefault","ScopeWebsite"],"Groups":[{"ID":"b","Label":"GroupLabelB2","Scope":["ScopeDefault"],"Fields":[{"ID":"c","Default":"c"}]},{"ID":"b2","Fields":[{"ID":"d","Default":"d"}]}]}]` + "\n", wantLen: 2, }, 2: { have: []config.SectionSlice{ config.SectionSlice{ &config.Section{ID: "a", Label: "SectionLabelA", SortOrder: 20, Permission: 22}, }, config.SectionSlice{ &config.Section{ID: "a", Scope: config.NewScopePerm(config.ScopeDefaultID, config.ScopeWebsiteID), SortOrder: 10, Permission: 3}, }, }, wantErr: "", want: `[{"ID":"a","Label":"SectionLabelA","Scope":["ScopeDefault","ScopeWebsite"],"SortOrder":10,"Permission":3,"Groups":null}]` + "\n", }, 3: { have: []config.SectionSlice{ config.SectionSlice{ &config.Section{ ID: "a", Label: "SectionLabelA", Groups: config.GroupSlice{ &config.Group{ ID: "b", Label: "SectionAGroupB", Comment: "SectionAGroupBComment", Scope: config.NewScopePerm(config.ScopeDefaultID), }, }, }, }, config.SectionSlice{ &config.Section{ ID: "a", SortOrder: 1000, Scope: config.NewScopePerm(config.ScopeDefaultID, config.ScopeWebsiteID), Groups: config.GroupSlice{ &config.Group{ID: "b", Label: "GroupLabelB1", Scope: config.ScopePermAll}, &config.Group{ID: "b", Label: "GroupLabelB2", Comment: "Section2AGroup3BComment", SortOrder: 100}, &config.Group{ID: "b2"}, }, }, }, }, wantErr: "", want: `[{"ID":"a","Label":"SectionLabelA","Scope":["ScopeDefault","ScopeWebsite"],"SortOrder":1000,"Groups":[{"ID":"b","Label":"GroupLabelB2","Comment":"Section2AGroup3BComment","Scope":["ScopeDefault","ScopeWebsite","ScopeStore"],"SortOrder":100,"Fields":null},{"ID":"b2","Fields":null}]}]` + "\n", }, 4: { have: []config.SectionSlice{ config.SectionSlice{ &config.Section{ ID: "a", Groups: config.GroupSlice{ &config.Group{ ID: "b", Label: "b1", Fields: config.FieldSlice{ &config.Field{ID: "c", Default: `c`, Type: config.TypeMultiselect, SortOrder: 1001}, }, }, &config.Group{ ID: "b", Label: "b2", Fields: config.FieldSlice{ nil, &config.Field{ID: "d", Default: `d`, Comment: "Ring of fire", Type: config.TypeObscure}, &config.Field{ID: "c", Default: `haha`, Type: config.TypeSelect, Scope: config.NewScopePerm(config.ScopeDefaultID, config.ScopeWebsiteID)}, }, }, }, }, }, config.SectionSlice{ &config.Section{ ID: "a", Groups: config.GroupSlice{ &config.Group{ ID: "b", Label: "b3", Fields: config.FieldSlice{ &config.Field{ID: "d", Default: `overriddenD`, Label: "Sect2Group2Label4", Comment: "LOTR"}, &config.Field{ID: "c", Default: `overriddenHaha`, Type: config.TypeHidden}, }, }, }, }, }, }, wantErr: "", want: `[{"ID":"a","Groups":[{"ID":"b","Label":"b3","Fields":[{"ID":"c","Type":"hidden","Scope":["ScopeDefault","ScopeWebsite"],"SortOrder":1001,"Default":"overriddenHaha"},{"ID":"d","Type":"obscure","Label":"Sect2Group2Label4","Comment":"LOTR","Default":"overriddenD"}]}]}]` + "\n", wantLen: 2, }, 5: { have: []config.SectionSlice{ config.SectionSlice{ &config.Section{ ID: "a", Groups: config.GroupSlice{ &config.Group{ ID: "b", Fields: config.FieldSlice{ &config.Field{ ID: "c", Default: `c`, Type: config.TypeMultiselect, }, }, }, }, }, }, config.SectionSlice{ nil, &config.Section{ ID: "a", Groups: config.GroupSlice{ &config.Group{ ID: "b", Fields: config.FieldSlice{ nil, &config.Field{ ID: "c", Default: `overridenC`, Type: config.TypeSelect, Label: "Sect2Group2Label4", Comment: "LOTR", SortOrder: 100, Visible: config.VisibleYes, }, }, }, }, }, }, }, wantErr: "", wantLen: 1, want: `[{"ID":"a","Groups":[{"ID":"b","Fields":[{"ID":"c","Type":"select","Label":"Sect2Group2Label4","Comment":"LOTR","SortOrder":100,"Visible":true,"Default":"overridenC"}]}]}]` + "\n", }, } for i, test := range tests { if len(test.have) == 0 { test.want = "null\n" } var baseSl config.SectionSlice haveErr := baseSl.MergeMultiple(test.have...) if test.wantErr != "" { assert.Len(t, baseSl, 0) assert.Error(t, haveErr) assert.Contains(t, haveErr.Error(), test.wantErr) } else { assert.NoError(t, haveErr) j := baseSl.ToJSON() if j != test.want { t.Errorf("\nIndex: %d\nExpected: %s\nActual: %s\n", i, test.want, j) } } assert.Exactly(t, test.wantLen, baseSl.TotalFields(), "Index %d", i) } }
func init() { PackageConfiguration = config.NewConfiguration( &config.Section{ ID: "currency", Label: "Currency Setup", SortOrder: 60, Scope: config.ScopePermAll, Groups: config.GroupSlice{ &config.Group{ ID: "options", Label: `Currency Options`, Comment: ``, SortOrder: 30, Scope: config.ScopePermAll, Fields: config.FieldSlice{ &config.Field{ // Path: `currency/options/base`, ID: "base", Label: `Base Currency`, Comment: `Base currency is used for all online payment transactions. If you have more than one store view, the base currency scope is defined by the catalog price scope ("Catalog" > "Price" > "Catalog Price Scope").`, Type: config.TypeSelect, SortOrder: 1, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID, config.ScopeWebsiteID), Default: `USD`, BackendModel: nil, // Magento\Config\Model\Config\Backend\Currency\Base SourceModel: nil, // Magento\Config\Model\Config\Source\Locale\Currency }, &config.Field{ // Path: `currency/options/default`, ID: "default", Label: `Default Display Currency`, Comment: ``, Type: config.TypeSelect, SortOrder: 2, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: `USD`, BackendModel: nil, // Magento\Config\Model\Config\Backend\Currency\DefaultCurrency SourceModel: nil, // Magento\Config\Model\Config\Source\Locale\Currency }, &config.Field{ // Path: `currency/options/allow`, ID: "allow", Label: `Allowed Currencies`, Comment: ``, Type: config.TypeMultiselect, SortOrder: 3, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: `USD,EUR`, BackendModel: nil, // Magento\Config\Model\Config\Backend\Currency\Allow SourceModel: nil, // Magento\Config\Model\Config\Source\Locale\Currency }, }, }, &config.Group{ ID: "webservicex", Label: `Webservicex`, Comment: ``, SortOrder: 40, Scope: config.NewScopePerm(config.ScopeDefaultID), Fields: config.FieldSlice{ &config.Field{ // Path: `currency/webservicex/timeout`, ID: "timeout", Label: `Connection Timeout in Seconds`, Comment: ``, Type: config.TypeText, SortOrder: 0, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID), Default: 100, BackendModel: nil, SourceModel: nil, }, }, }, &config.Group{ ID: "import", Label: `Scheduled Import Settings`, Comment: ``, SortOrder: 50, Scope: config.NewScopePerm(config.ScopeDefaultID), Fields: config.FieldSlice{ &config.Field{ // Path: `currency/import/enabled`, ID: "enabled", Label: `Enabled`, Comment: ``, Type: config.TypeSelect, SortOrder: 1, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: false, BackendModel: nil, SourceModel: nil, // Magento\Config\Model\Config\Source\Yesno }, &config.Field{ // Path: `currency/import/error_email`, ID: "error_email", Label: `Error Email Recipient`, Comment: ``, Type: config.TypeText, SortOrder: 5, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, SourceModel: nil, }, &config.Field{ // Path: `currency/import/error_email_identity`, ID: "error_email_identity", Label: `Error Email Sender`, Comment: ``, Type: config.TypeSelect, SortOrder: 6, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID, config.ScopeWebsiteID), Default: `general`, BackendModel: nil, SourceModel: nil, // Magento\Config\Model\Config\Source\Email\Identity }, &config.Field{ // Path: `currency/import/error_email_template`, ID: "error_email_template", Label: `Error Email Template`, Comment: ``, Type: config.TypeSelect, SortOrder: 7, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID, config.ScopeWebsiteID), Default: `currency_import_error_email_template`, BackendModel: nil, SourceModel: nil, // Magento\Config\Model\Config\Source\Email\Template }, &config.Field{ // Path: `currency/import/frequency`, ID: "frequency", Label: `Frequency`, Comment: ``, Type: config.TypeSelect, SortOrder: 4, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, SourceModel: nil, // Magento\Cron\Model\Config\Source\Frequency }, &config.Field{ // Path: `currency/import/service`, ID: "service", Label: `Service`, Comment: ``, Type: config.TypeSelect, SortOrder: 2, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, // Magento\Config\Model\Config\Backend\Currency\Cron SourceModel: nil, // Magento\Directory\Model\Currency\Import\Source\Service }, &config.Field{ // Path: `currency/import/time`, ID: "time", Label: `Start Time`, Comment: ``, Type: config.TypeTime, SortOrder: 3, Visible: config.VisibleYes, Scope: config.ScopePermAll, Default: nil, BackendModel: nil, SourceModel: nil, }, }, }, }, }, &config.Section{ ID: "system", Scope: config.NewScopePerm(), Groups: config.GroupSlice{ &config.Group{ ID: "currency", Label: `Currency`, Comment: ``, SortOrder: 50, Scope: config.NewScopePerm(config.ScopeDefaultID), Fields: config.FieldSlice{ &config.Field{ // Path: `system/currency/installed`, ID: "installed", Label: `Installed Currencies`, Comment: ``, Type: config.TypeMultiselect, SortOrder: 1, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID), Default: `AZN,AZM,AFN,ALL,DZD,AOA,ARS,AMD,AWG,AUD,BSD,BHD,BDT,BBD,BYR,BZD,BMD,BTN,BOB,BAM,BWP,BRL,GBP,BND,BGN,BUK,BIF,KHR,CAD,CVE,CZK,KYD,CLP,CNY,COP,KMF,CDF,CRC,HRK,CUP,DKK,DJF,DOP,XCD,EGP,SVC,GQE,ERN,EEK,ETB,EUR,FKP,FJD,GMD,GEK,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KWD,KGS,LAK,LVL,LBP,LSL,LRD,LYD,LTL,MOP,MKD,MGA,MWK,MYR,MVR,LSM,MRO,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,ANG,TRL,TRY,NZD,NIC,NGN,KPW,NOK,OMR,PKR,PAB,PGK,PYG,PEN,PHP,PLN,QAR,RHD,RON,ROL,RUB,RWF,SHP,STD,SAR,RSD,SCR,SLL,SGD,SKK,SBD,SOS,ZAR,KRW,LKR,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TMM,USD,UGX,UAH,AED,UYU,UZS,VUV,VEB,VEF,VND,CHE,CHW,XOF,XPF,WST,YER,ZMK,ZWD`, BackendModel: nil, // Magento\Config\Model\Config\Backend\Locale SourceModel: NewSourceCurrencyAll(), // Magento\Config\Model\Config\Source\Locale\Currency\All }, }, }, }, }, &config.Section{ ID: "general", Scope: config.NewScopePerm(), Groups: config.GroupSlice{ &config.Group{ ID: "country", Scope: config.NewScopePerm(), Fields: config.FieldSlice{ &config.Field{ // Path: `general/country/optional_zip_countries`, ID: "optional_zip_countries", Label: `Zip/Postal Code is Optional for`, Comment: ``, Type: config.TypeMultiselect, SortOrder: 3, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID), Default: `HK,IE,MO,PA,GB`, BackendModel: nil, SourceModel: nil, // Magento\Directory\Model\Config\Source\Country }, }, }, &config.Group{ ID: "region", Label: `State Options`, SortOrder: 4, Scope: config.NewScopePerm(config.ScopeDefaultID), Fields: config.FieldSlice{ &config.Field{ // Path: `general/region/state_required`, ID: "state_required", Label: `State is Required for`, Comment: ``, Type: config.TypeMultiselect, SortOrder: 1, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID), Default: nil, BackendModel: nil, SourceModel: nil, // Magento\Directory\Model\Config\Source\Country }, &config.Field{ // Path: `general/region/display_all`, ID: "display_all", Label: `Allow to Choose State if It is Optional for Country`, Comment: ``, Type: config.TypeSelect, SortOrder: 8, Visible: config.VisibleYes, Scope: config.NewScopePerm(config.ScopeDefaultID), Default: nil, BackendModel: nil, SourceModel: nil, // Magento\Config\Model\Config\Source\Yesno }, }, }, }, }, // Hidden Configuration &config.Section{ ID: "general", Groups: config.GroupSlice{ &config.Group{ ID: "country", Fields: config.FieldSlice{ &config.Field{ // Path: `general/country/allow`, ID: "allow", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `AF,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AX,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BL,BT,BO,BA,BW,BV,BR,IO,VG,BN,BG,BF,BI,KH,CM,CA,CD,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CK,CR,HR,CU,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GG,GH,GI,GR,GL,GD,GP,GU,GT,GN,GW,GY,HT,HM,HN,HK,HU,IS,IM,IN,ID,IR,IQ,IE,IL,IT,CI,JE,JM,JP,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,ME,MF,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,FX,MX,FM,MD,MC,MN,MS,MA,MZ,MM,NA,NR,NP,NL,AN,NC,NZ,NI,NE,NG,NU,NF,KP,MP,NO,OM,PK,PW,PA,PG,PY,PE,PH,PN,PL,PS,PT,PR,QA,RE,RO,RS,RU,RW,SH,KN,LC,PM,VC,WS,SM,ST,SA,SN,SC,SL,SG,SK,SI,SB,SO,ZA,GS,KR,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TL,TW,TJ,TZ,TH,TG,TK,TO,TT,TN,TR,TM,TC,TV,VI,UG,UA,AE,GB,US,UM,UY,UZ,VU,VA,VE,VN,WF,EH,YE,ZM,ZW`, }, &config.Field{ // Path: `general/country/default`, ID: "default", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `US`, }, }, }, &config.Group{ ID: "locale", Fields: config.FieldSlice{ &config.Field{ // Path: `general/locale/datetime_format_long`, ID: "datetime_format_long", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `%A, %B %e %Y [%I:%M %p]`, }, &config.Field{ // Path: `general/locale/datetime_format_medium`, ID: "datetime_format_medium", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `%a, %b %e %Y [%I:%M %p]`, }, &config.Field{ // Path: `general/locale/datetime_format_short`, ID: "datetime_format_short", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `%m/%d/%y [%I:%M %p]`, }, &config.Field{ // Path: `general/locale/date_format_long`, ID: "date_format_long", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `%A, %B %e %Y`, }, &config.Field{ // Path: `general/locale/date_format_medium`, ID: "date_format_medium", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `%a, %b %e %Y`, }, &config.Field{ // Path: `general/locale/date_format_short`, ID: "date_format_short", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `%m/%d/%y`, }, &config.Field{ // Path: `general/locale/language`, ID: "language", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `en`, }, &config.Field{ // Path: `general/locale/code`, ID: "code", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `en_US`, }, &config.Field{ // Path: `general/locale/timezone`, ID: "timezone", Type: config.TypeHidden, Visible: config.VisibleNo, Scope: config.NewScopePerm(config.ScopeDefaultID), // @todo search for that Default: `America/Los_Angeles`, }, }, }, }, }, ) }