当前位置: 首页>>代码示例>>Golang>>正文


Golang config.NewConfiguration函数代码示例

本文整理汇总了Golang中github.com/corestoreio/csfw/config.NewConfiguration函数的典型用法代码示例。如果您正苦于以下问题:Golang NewConfiguration函数的具体用法?Golang NewConfiguration怎么用?Golang NewConfiguration使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewConfiguration函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestScopeApplyDefaults

func TestScopeApplyDefaults(t *testing.T) {
	pkgCfg := config.NewConfiguration(
		&config.Section{
			ID: "contact",
			Groups: config.GroupSlice{
				&config.Group{
					ID: "contact",
					Fields: config.FieldSlice{
						&config.Field{
							// Path: `contact/contact/enabled`,
							ID:      "enabled",
							Default: true,
						},
					},
				},
				&config.Group{
					ID: "email",
					Fields: config.FieldSlice{
						&config.Field{
							// Path: `contact/email/recipient_email`,
							ID:      "recipient_email",
							Default: `[email protected]`,
						},
						&config.Field{
							// Path: `contact/email/sender_email_identity`,
							ID:      "sender_email_identity",
							Default: 2.7182818284590452353602874713527,
						},
						&config.Field{
							// Path: `contact/email/email_template`,
							ID:      "email_template",
							Default: 4711,
						},
					},
				},
			},
		},
	)
	s := config.NewManager()
	s.ApplyDefaults(pkgCfg)
	cer, err := pkgCfg.FindFieldByPath("contact", "email", "recipient_email")
	if err != nil {
		t.Error(err)
		return
	}
	assert.Exactly(t, cer.Default.(string), s.GetString(config.Path("contact/email/recipient_email")))
}
开发者ID:bom-d-van,项目名称:csfw,代码行数:47,代码来源:manager_test.go

示例2: TestSectionSliceDefaults

func TestSectionSliceDefaults(t *testing.T) {
	pkgCfg := config.NewConfiguration(
		&config.Section{
			ID: "contact",
			Groups: config.GroupSlice{
				&config.Group{
					ID: "contact",
					Fields: config.FieldSlice{
						&config.Field{
							// Path: `contact/contact/enabled`,
							ID:      "enabled",
							Default: true,
						},
					},
				},
				&config.Group{
					ID: "email",
					Fields: config.FieldSlice{
						&config.Field{
							// Path: `contact/email/recipient_email`,
							ID:      "recipient_email",
							Default: `[email protected]`,
						},
						&config.Field{
							// Path: `contact/email/sender_email_identity`,
							ID:      "sender_email_identity",
							Default: 2.7182818284590452353602874713527,
						},
						&config.Field{
							// Path: `contact/email/email_template`,
							ID:      "email_template",
							Default: 4711,
						},
					},
				},
			},
		},
	)

	assert.Exactly(
		t,
		config.DefaultMap{"default/0/contact/email/sender_email_identity": 2.718281828459045, "default/0/contact/email/email_template": 4711, "default/0/contact/contact/enabled": true, "default/0/contact/email/recipient_email": "[email protected]"},
		pkgCfg.Defaults(),
	)
}
开发者ID:hafeez3000,项目名称:csfw,代码行数:45,代码来源:elements_test.go

示例3:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "payment",
		Label:     "",
		SortOrder: 0,
		Scope:     nil,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "authorizenet_directpost",
				Label:     `Authorize.net Direct Post`,
				Comment:   ``,
				SortOrder: 34,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `payment/authorizenet_directpost/active`,
						ID:           "active",
						Label:        `Enabled`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    10,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      false,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `payment/authorizenet_directpost/payment_action`,
						ID:           "payment_action",
						Label:        `Payment Action`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    20,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      `authorize`,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Authorizenet\Model\Source\PaymentAction
					},

					&config.Field{
						// Path: `payment/authorizenet_directpost/title`,
						ID:           "title",
						Label:        `Title`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    30,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `Credit Card Direct Post (Authorize.net)`,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `payment/authorizenet_directpost/login`,
						ID:           "login",
						Label:        `API Login ID`,
						Comment:      ``,
						Type:         config.TypeObscure,
						SortOrder:    40,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      nil,
						BackendModel: nil, // Magento\Config\Model\Config\Backend\Encrypted // @todo Magento\Config\Model\Config\Backend\Encrypted
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `payment/authorizenet_directpost/trans_key`,
						ID:           "trans_key",
						Label:        `Transaction Key`,
						Comment:      ``,
						Type:         config.TypeObscure,
						SortOrder:    50,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      nil,
						BackendModel: nil, // Magento\Config\Model\Config\Backend\Encrypted // @todo Magento\Config\Model\Config\Backend\Encrypted
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `payment/authorizenet_directpost/trans_md5`,
						ID:           "trans_md5",
						Label:        `Merchant MD5`,
						Comment:      ``,
						Type:         config.TypeObscure,
						SortOrder:    60,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      nil,
						BackendModel: nil, // Magento\Config\Model\Config\Backend\Encrypted // @todo Magento\Config\Model\Config\Backend\Encrypted
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `payment/authorizenet_directpost/order_status`,
//.........这里部分代码省略.........
开发者ID:hafeez3000,项目名称:csfw,代码行数:101,代码来源:config_authorizenet.go

示例4:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "catalog",
		Label:     "",
		SortOrder: 0,
		Scope:     nil,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "downloadable",
				Label:     `Downloadable Product Options`,
				Comment:   ``,
				SortOrder: 600,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `catalog/downloadable/order_item_status`,
						ID:           "order_item_status",
						Label:        `Order Item Status to Enable Downloads`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    100,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      9,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Downloadable\Model\System\Config\Source\Orderitemstatus
					},

					&config.Field{
						// Path: `catalog/downloadable/downloads_number`,
						ID:           "downloads_number",
						Label:        `Default Maximum Number of Downloads`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    200,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      0,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `catalog/downloadable/shareable`,
						ID:           "shareable",
						Label:        `Shareable`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    300,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `catalog/downloadable/samples_title`,
						ID:           "samples_title",
						Label:        `Default Sample Title`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    400,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `Samples`,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `catalog/downloadable/links_title`,
						ID:           "links_title",
						Label:        `Default Link Title`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    500,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `Links`,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `catalog/downloadable/links_target_new_window`,
						ID:           "links_target_new_window",
						Label:        `Open Links in New Window`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    600,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      true,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `catalog/downloadable/content_disposition`,
//.........这里部分代码省略.........
开发者ID:hafeez3000,项目名称:csfw,代码行数:101,代码来源:config_downloadable.go

示例5:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "catalog",
		Label:     "",
		SortOrder: 0,
		Scope:     nil,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "recently_products",
				Label:     `Recently Viewed/Compared Products`,
				Comment:   ``,
				SortOrder: 350,
				Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `catalog/recently_products/scope`,
						ID:           "scope",
						Label:        `Show for Current`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      `website`,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Reports\Scope
					},

					&config.Field{
						// Path: `catalog/recently_products/viewed_count`,
						ID:           "viewed_count",
						Label:        `Default Recently Viewed Products Count`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    20,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      5,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `catalog/recently_products/compared_count`,
						ID:           "compared_count",
						Label:        `Default Recently Compared Products Count`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    30,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      5,
						BackendModel: nil,
						SourceModel:  nil,
					},
				},
			},
		},
	},
	&config.Section{
		ID:        "reports",
		Label:     "Reports",
		SortOrder: 1000,
		Scope:     scope.NewPerm(scope.DefaultID),
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "dashboard",
				Label:     `Dashboard`,
				Comment:   ``,
				SortOrder: 1,
				Scope:     scope.NewPerm(scope.DefaultID),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `reports/dashboard/ytd_start`,
						ID:           "ytd_start",
						Label:        `Year-To-Date Starts`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      `1,1`,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `reports/dashboard/mtd_start`,
						ID:           "mtd_start",
						Label:        `Current Month Starts`,
						Comment:      `Select day of the month.`,
						Type:         config.TypeSelect,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      true,
						BackendModel: nil,
						SourceModel:  nil,
					},
				},
//.........这里部分代码省略.........
开发者ID:hafeez3000,项目名称:csfw,代码行数:101,代码来源:config_reports.go

示例6: init

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:bom-d-van,项目名称:csfw,代码行数:101,代码来源:config.go

示例7:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "catalog",
		Label:     "",
		SortOrder: 0,
		Scope:     nil,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "seo",
				Label:     `Search Engine Optimization`,
				Comment:   ``,
				SortOrder: 0,
				Scope:     nil,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `catalog/seo/category_url_suffix`,
						ID:           "category_url_suffix",
						Label:        `Category URL Suffix`,
						Comment:      `You need to refresh the cache.`,
						Type:         config.TypeText,
						SortOrder:    3,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil, // Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite\Suffix
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `catalog/seo/product_url_suffix`,
						ID:           "product_url_suffix",
						Label:        `Product URL Suffix`,
						Comment:      `You need to refresh the cache.`,
						Type:         config.TypeText,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil, // Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite\Suffix
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `catalog/seo/product_use_categories`,
						ID:           "product_use_categories",
						Label:        `Use Categories Path for Product URLs`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    4,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `catalog/seo/save_rewrites_history`,
						ID:           "save_rewrites_history",
						Label:        `Create Permanent Redirect for URLs if URL Key Changed`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    5,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},
				},
			},
		},
	},
)
开发者ID:hafeez3000,项目名称:csfw,代码行数:74,代码来源:config_catalogurlrewrite.go

示例8:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "advanced",
		Label:     "Advanced",
		SortOrder: 910,
		Scope:     config.ScopePermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "modules_disable_output",
				Label:     `Disable Modules Output`,
				Comment:   ``,
				SortOrder: 2,
				Scope:     config.ScopePermAll,
				Fields:    config.FieldSlice{},
			},
		},
	},
	&config.Section{
		ID:        "trans_email",
		Label:     "Store Email Addresses",
		SortOrder: 90,
		Scope:     config.ScopePermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "ident_custom1",
				Label:     `Custom Email 1`,
				Comment:   ``,
				SortOrder: 4,
				Scope:     config.ScopePermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `trans_email/ident_custom1/email`,
						ID:           "email",
						Label:        `Sender Email`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        config.ScopePermAll,
						Default:      nil,
						BackendModel: nil, // Magento\Config\Model\Config\Backend\Email\Address
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `trans_email/ident_custom1/name`,
						ID:           "name",
						Label:        `Sender Name`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        config.ScopePermAll,
						Default:      nil,
						BackendModel: nil, // Magento\Config\Model\Config\Backend\Email\Sender
						SourceModel:  nil,
					},
				},
			},

			&config.Group{
				ID:        "ident_custom2",
				Label:     `Custom Email 2`,
				Comment:   ``,
				SortOrder: 5,
				Scope:     config.ScopePermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `trans_email/ident_custom2/email`,
						ID:           "email",
						Label:        `Sender Email`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        config.ScopePermAll,
						Default:      nil,
						BackendModel: nil, // Magento\Config\Model\Config\Backend\Email\Address
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `trans_email/ident_custom2/name`,
						ID:           "name",
						Label:        `Sender Name`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        config.ScopePermAll,
						Default:      nil,
						BackendModel: nil, // Magento\Config\Model\Config\Backend\Email\Sender
						SourceModel:  nil,
					},
				},
			},

			&config.Group{
				ID:        "ident_general",
				Label:     `General Contact`,
//.........这里部分代码省略.........
开发者ID:optimuse,项目名称:csfw,代码行数:101,代码来源:config.go

示例9:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "carriers",
		Label:     "",
		SortOrder: 0,
		Scope:     nil,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "usps",
				Label:     `USPS`,
				Comment:   ``,
				SortOrder: 110,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `carriers/usps/active`,
						ID:           "active",
						Label:        `Enabled for Checkout`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    10,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      false,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `carriers/usps/gateway_url`,
						ID:           "gateway_url",
						Label:        `Gateway URL`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    20,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      `http://production.shippingapis.com/ShippingAPI.dll`,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `carriers/usps/gateway_secure_url`,
						ID:           "gateway_secure_url",
						Label:        `Secure Gateway URL`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    30,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      `https://secure.shippingapis.com/ShippingAPI.dll`,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `carriers/usps/title`,
						ID:           "title",
						Label:        `Title`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    40,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `United States Postal Service`,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `carriers/usps/userid`,
						ID:           "userid",
						Label:        `User ID`,
						Comment:      ``,
						Type:         config.TypeObscure,
						SortOrder:    50,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      nil,
						BackendModel: nil, // Magento\Config\Model\Config\Backend\Encrypted // @todo Magento\Config\Model\Config\Backend\Encrypted
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `carriers/usps/password`,
						ID:           "password",
						Label:        `Password`,
						Comment:      ``,
						Type:         config.TypeObscure,
						SortOrder:    53,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      nil,
						BackendModel: nil, // Magento\Config\Model\Config\Backend\Encrypted // @todo Magento\Config\Model\Config\Backend\Encrypted
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `carriers/usps/mode`,
//.........这里部分代码省略.........
开发者ID:hafeez3000,项目名称:csfw,代码行数:101,代码来源:config_usps.go

示例10:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "promo",
		Label:     "Promotions",
		SortOrder: 400,
		Scope:     scope.NewPerm(scope.DefaultID),
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "auto_generated_coupon_codes",
				Label:     `Auto Generated Specific Coupon Codes`,
				Comment:   ``,
				SortOrder: 10,
				Scope:     scope.NewPerm(scope.DefaultID),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `promo/auto_generated_coupon_codes/length`,
						ID:           "length",
						Label:        `Code Length`,
						Comment:      `Excluding prefix, suffix and separators.`,
						Type:         config.TypeText,
						SortOrder:    10,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      12,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `promo/auto_generated_coupon_codes/format`,
						ID:           "format",
						Label:        `Code Format`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    20,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      true,
						BackendModel: nil,
						SourceModel:  nil, // Magento\SalesRule\Model\System\Config\Source\Coupon\Format
					},

					&config.Field{
						// Path: `promo/auto_generated_coupon_codes/prefix`,
						ID:           "prefix",
						Label:        `Code Prefix`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    30,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `promo/auto_generated_coupon_codes/suffix`,
						ID:           "suffix",
						Label:        `Code Suffix`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    40,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `promo/auto_generated_coupon_codes/dash`,
						ID:           "dash",
						Label:        `Dash Every X Characters`,
						Comment:      `If empty no separation.`,
						Type:         config.TypeText,
						SortOrder:    50,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil,
					},
				},
			},
		},
	},
	&config.Section{
		ID:        "rss",
		Label:     "",
		SortOrder: 0,
		Scope:     scope.NewPerm(),
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "catalog",
				Label:     ``,
				Comment:   ``,
				SortOrder: 0,
				Scope:     scope.NewPerm(),
				Fields: config.FieldSlice{
//.........这里部分代码省略.........
开发者ID:hafeez3000,项目名称:csfw,代码行数:101,代码来源:config_salesrule.go

示例11:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "sales",
		Label:     "",
		SortOrder: 0,
		Scope:     nil,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "msrp",
				Label:     `Minimum Advertised Price`,
				Comment:   ``,
				SortOrder: 110,
				Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `sales/msrp/enabled`,
						ID:           "enabled",
						Label:        `Enable MAP`,
						Comment:      `<strong style="color:red">Warning!</strong> Enabling MAP by default will hide all product prices on Storefront.`,
						Type:         config.TypeSelect,
						SortOrder:    10,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      false,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `sales/msrp/display_price_type`,
						ID:           "display_price_type",
						Label:        `Display Actual Price`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    30,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      true,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Msrp\Model\Product\Attribute\Source\Type
					},

					&config.Field{
						// Path: `sales/msrp/explanation_message`,
						ID:           "explanation_message",
						Label:        `Default Popup Text Message`,
						Comment:      ``,
						Type:         config.TypeTextarea,
						SortOrder:    40,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `Our price is lower than the manufacturer's "minimum advertised price." As a result, we cannot show you the price in catalog or the product page. <br /><br /> You have no obligation to purchase the product once you know the price. You can simply remove the item from your cart.`,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `sales/msrp/explanation_message_whats_this`,
						ID:           "explanation_message_whats_this",
						Label:        `Default "What's This" Text Message`,
						Comment:      ``,
						Type:         config.TypeTextarea,
						SortOrder:    50,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `Our price is lower than the manufacturer's "minimum advertised price." As a result, we cannot show you the price in catalog or the product page. <br /><br /> You have no obligation to purchase the product once you know the price. You can simply remove the item from your cart.`,
						BackendModel: nil,
						SourceModel:  nil,
					},
				},
			},
		},
	},
)
开发者ID:hafeez3000,项目名称:csfw,代码行数:74,代码来源:config_msrp.go

示例12:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "multishipping",
		Label:     "Multishipping Settings",
		SortOrder: 311,
		Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "options",
				Label:     `Options`,
				Comment:   ``,
				SortOrder: 2,
				Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `multishipping/options/checkout_multiple`,
						ID:           "checkout_multiple",
						Label:        `Allow Shipping to Multiple Addresses`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      true,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `multishipping/options/checkout_multiple_maximum_qty`,
						ID:           "checkout_multiple_maximum_qty",
						Label:        `Maximum Qty Allowed for Shipping to Multiple Addresses`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      100,
						BackendModel: nil,
						SourceModel:  nil,
					},
				},
			},
		},
	},
)
开发者ID:hafeez3000,项目名称:csfw,代码行数:46,代码来源:config_multishipping.go

示例13:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "google",
		Label:     "Google API",
		SortOrder: 340,
		Scope:     scope.PermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "analytics",
				Label:     `Google Analytics`,
				Comment:   ``,
				SortOrder: 10,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `google/analytics/active`,
						ID:           "active",
						Label:        `Enable`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    10,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `google/analytics/account`,
						ID:           "account",
						Label:        `Account Number`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    20,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil,
					},
				},
			},
		},
	},
)
开发者ID:hafeez3000,项目名称:csfw,代码行数:46,代码来源:config_googleanalytics.go

示例14:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "customer",
		Label:     "Customer Configuration",
		SortOrder: 130,
		Scope:     scope.PermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "account_share",
				Label:     `Account Sharing Options`,
				Comment:   ``,
				SortOrder: 10,
				Scope:     scope.NewPerm(scope.DefaultID),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `customer/account_share/scope`,
						ID:           "scope",
						Label:        `Share Customer Accounts`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      true,
						BackendModel: nil, // Magento\Customer\Model\Config\Share
						SourceModel:  nil, // Magento\Customer\Model\Config\Share
					},
				},
			},

			&config.Group{
				ID:        "create_account",
				Label:     `Create New Account Options`,
				Comment:   ``,
				SortOrder: 20,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `customer/create_account/auto_group_assign`,
						ID:           "auto_group_assign",
						Label:        `Enable Automatic Assignment to Customer Group`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    10,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `customer/create_account/tax_calculation_address_type`,
						ID:           "tax_calculation_address_type",
						Label:        `Tax Calculation Based On`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    10,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `billing`,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Customer\Model\Config\Source\Address\Type
					},

					&config.Field{
						// Path: `customer/create_account/default_group`,
						ID:           "default_group",
						Label:        `Default Group`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    20,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      true,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Customer\Model\Config\Source\Group
					},

					&config.Field{
						// Path: `customer/create_account/viv_domestic_group`,
						ID:           "viv_domestic_group",
						Label:        `Group for Valid VAT ID - Domestic`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    30,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Customer\Model\Config\Source\Group
					},

					&config.Field{
						// Path: `customer/create_account/viv_intra_union_group`,
						ID:           "viv_intra_union_group",
						Label:        `Group for Valid VAT ID - Intra-Union`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    40,
//.........这里部分代码省略.........
开发者ID:hafeez3000,项目名称:csfw,代码行数:101,代码来源:config_customer.go

示例15:

var PackageConfiguration = config.NewConfiguration(
	&config.Section{
		ID:        "catalog",
		Label:     "",
		SortOrder: 0,
		Scope:     nil,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "review",
				Label:     `Product Reviews`,
				Comment:   ``,
				SortOrder: 100,
				Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `catalog/review/allow_guest`,
						ID:           "allow_guest",
						Label:        `Allow Guests to Write Reviews`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      true,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},
				},
			},
		},
	},
)
开发者ID:hafeez3000,项目名称:csfw,代码行数:32,代码来源:config_review.go


注:本文中的github.com/corestoreio/csfw/config.NewConfiguration函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。