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


Golang config.MustNewConfiguration函数代码示例

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


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

示例1: init

func init() {
	PackageConfiguration = config.MustNewConfiguration(
		&config.Section{
			ID: "web", // defined in ?
			Groups: config.GroupSlice{
				&config.Group{
					ID:        "cors",
					Label:     `CORS Cross Origin Resource Sharing`,
					Comment:   ``,
					SortOrder: 150,
					Scope:     scope.NewPerm(scope.DefaultID),
					Fields: config.FieldSlice{
						&config.Field{
							// Path: `web/cors/exposed_headers`,
							ID:           "exposed_headers",
							Label:        `Exposed Headers`,
							Comment:      `Indicates which headers are safe to expose to the API of a CORS API specification. Separate via line break`,
							Type:         config.TypeTextarea,
							SortOrder:    10,
							Visible:      config.VisibleYes,
							Scope:        scope.NewPerm(scope.WebsiteID),
							Default:      nil,
							BackendModel: nil, // CSV
							SourceModel:  nil,
						},
						&config.Field{
							// Path: `web/cors/allowed_origins`,
							ID:    "allowed_origins",
							Label: `Allowed Origins`,
							Comment: `Is a list of origins a cross-domain request can be executed from.
If the special "*" value is present in the list, all origins will be allowed.
An origin may contain a wildcard (*) to replace 0 or more characters
(i.e.: http://*.domain.com). Usage of wildcards implies a small performance penality.
Only one wildcard can be used per origin.
Default value is ["*"]`,
							Type:         config.TypeTextarea,
							SortOrder:    20,
							Visible:      config.VisibleYes,
							Scope:        scope.NewPerm(scope.WebsiteID),
							Default:      nil,
							BackendModel: nil, // CSV
							SourceModel:  nil,
						},
						// TODO add other fields
					},
				},
			},
		},
	)
}
开发者ID:joao-parana,项目名称:csfw,代码行数:50,代码来源:config.go

示例2: TestScopeApplyDefaults

func TestScopeApplyDefaults(t *testing.T) {
	pkgCfg := config.MustNewConfiguration(
		&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
	}
	sval, err := s.GetString(config.Path("contact/email/recipient_email"))
	assert.NoError(t, err)
	assert.Exactly(t, cer.Default.(string), sval)
}
开发者ID:levcom,项目名称:csfw,代码行数:49,代码来源:manager_test.go

示例3: TestSectionSliceDefaults

func TestSectionSliceDefaults(t *testing.T) {
	pkgCfg := config.MustNewConfiguration(
		&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:levcom,项目名称:csfw,代码行数:45,代码来源:elements_test.go

示例4:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "sales",
		Label:     "Sales",
		SortOrder: 300,
		Scope:     scope.PermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "general",
				Label:     `General`,
				Comment:   ``,
				SortOrder: 5,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `sales/general/hide_customer_ip`,
						ID:           "hide_customer_ip",
						Label:        `Hide Customer IP`,
						Comment:      `Choose whether a customer IP is shown in orders, invoices, shipments, and credit memos.`,
						Type:         config.TypeSelect,
						SortOrder:    0,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},
				},
			},

			&config.Group{
				ID:        "totals_sort",
				Label:     `Checkout Totals Sort Order`,
				Comment:   ``,
				SortOrder: 10,
				Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `sales/totals_sort/discount`,
						ID:           "discount",
						Label:        `Discount`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      20,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `sales/totals_sort/grand_total`,
						ID:           "grand_total",
						Label:        `Grand Total`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    5,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      100,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `sales/totals_sort/shipping`,
						ID:           "shipping",
						Label:        `Shipping`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    3,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      30,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `sales/totals_sort/subtotal`,
						ID:           "subtotal",
						Label:        `Subtotal`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID, scope.WebsiteID),
						Default:      10,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `sales/totals_sort/tax`,
						ID:           "tax",
						Label:        `Tax`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    4,
//.........这里部分代码省略.........
开发者ID:levcom,项目名称:csfw,代码行数:101,代码来源:config_sales.go

示例5:

var PackageConfiguration = config.MustNewConfiguration(
	&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:levcom,项目名称:csfw,代码行数:101,代码来源:config_reports.go

示例6: init

func init() {
	PackageConfiguration = config.MustNewConfiguration(
		&config.Section{
			ID:        "general",
			Label:     "General",
			SortOrder: 10,
			Scope:     scope.PermAll,

			Groups: config.GroupSlice{
				&config.Group{
					ID:        "single_store_mode",
					Label:     `Single-Store Mode`,
					Comment:   ``,
					SortOrder: 150,
					Scope:     scope.NewPerm(scope.DefaultID),
					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:        scope.NewPerm(scope.DefaultID),
							Default:      nil,
							BackendModel: nil,
							SourceModel:  configsource.YesNo, // Magento\Config\Model\Config\Source\Yesno
						},
					},
				},

				&config.Group{
					ID:        "store_information",
					Label:     `Store Information`,
					Comment:   ``,
					SortOrder: 100,
					Scope:     scope.PermAll,
					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:        scope.PermAll,
							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:        scope.PermAll,
							Default:      nil,
							BackendModel: nil,
							SourceModel:  nil,
						},
					},
				},
			},
		},

		&config.Section{
			ID:        "web",
			Label:     "Web",
			SortOrder: 20,
			Scope:     scope.PermAll,
			Groups: config.GroupSlice{
				&config.Group{
					ID:        "url",
					Label:     `Url Options`,
					Comment:   ``,
					SortOrder: 3,
					Scope:     scope.NewPerm(scope.DefaultID),
					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:        scope.NewPerm(scope.DefaultID),
							Default:      nil,
							BackendModel: nil,                // Magento\Config\Model\Config\Backend\Store
							SourceModel:  configsource.YesNo, // Magento\Config\Model\Config\Source\Yesno
						},

						&config.Field{
							// Path: `web/url/redirect_to_base`,
//.........这里部分代码省略.........
开发者ID:levcom,项目名称:csfw,代码行数:101,代码来源:config.go

示例7:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "catalog",
		Label:     "",
		SortOrder: 40,
		Scope:     scope.PermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "frontend",
				Label:     ``,
				Comment:   ``,
				SortOrder: 100,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `catalog/frontend/swatches_per_product`,
						ID:           "swatches_per_product",
						Label:        `Swatches per Product`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    300,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      16,
						BackendModel: nil,
						SourceModel:  nil,
					},
				},
			},
		},
	},

	// Hidden Configuration, may be visible somewhere else ...
	&config.Section{
		ID: "general",
		Groups: config.GroupSlice{
			&config.Group{
				ID: "validator_data",
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `general/validator_data/input_types`,
						ID:      "input_types",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: `{"swatch_visual":"swatch_visual","swatch_text":"swatch_text"}`,
					},
				},
			},
		},
	},
)
开发者ID:levcom,项目名称:csfw,代码行数:52,代码来源:config_swatches.go

示例8:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID: "google",
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "analytics",
				Label:     ``,
				Comment:   ``,
				SortOrder: 0,
				Scope:     nil,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `google/analytics/experiments`,
						ID:           "experiments",
						Label:        `Enable Content Experiments`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    30,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},
				},
			},
		},
	},

	// Hidden Configuration, may be visible somewhere else ...
	&config.Section{
		ID: "google",
		Groups: config.GroupSlice{
			&config.Group{
				ID: "optimizer",
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `google/optimizer/active`,
						ID:      "active",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: false,
					},
				},
			},
		},
	},
)
开发者ID:levcom,项目名称:csfw,代码行数:49,代码来源:config_googleoptimizer.go

示例9:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "payment",
		Label:     "Payment Methods",
		SortOrder: 400,
		Scope:     scope.PermAll,
		Groups:    config.GroupSlice{},
	},

	// Hidden Configuration, may be visible somewhere else ...
	&config.Section{
		ID: "payment",
		Groups: config.GroupSlice{
			&config.Group{
				ID: "free",
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `payment/free/active`,
						ID:      "active",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: true,
					},

					&config.Field{
						// Path: `payment/free/model`,
						ID:      "model",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: `Magento\Payment\Model\Method\Free`,
					},

					&config.Field{
						// Path: `payment/free/order_status`,
						ID:      "order_status",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: `pending`,
					},

					&config.Field{
						// Path: `payment/free/title`,
						ID:      "title",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: `No Payment Information Required`,
					},

					&config.Field{
						// Path: `payment/free/allowspecific`,
						ID:      "allowspecific",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: false,
					},

					&config.Field{
						// Path: `payment/free/sort_order`,
						ID:      "sort_order",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: true,
					},
				},
			},

			&config.Group{
				ID: "substitution",
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `payment/substitution/active`,
						ID:      "active",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: false,
					},

					&config.Field{
						// Path: `payment/substitution/model`,
						ID:      "model",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: `Magento\Payment\Model\Method\Substitution`,
					},

					&config.Field{
						// Path: `payment/substitution/allowspecific`,
						ID:      "allowspecific",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: false,
//.........这里部分代码省略.........
开发者ID:levcom,项目名称:csfw,代码行数:101,代码来源:config_payment.go

示例10:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "webapi",
		Label:     "Magento Web API",
		SortOrder: 102,
		Scope:     scope.PermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "soap",
				Label:     `SOAP Settings`,
				Comment:   ``,
				SortOrder: 1,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `webapi/soap/charset`,
						ID:           "charset",
						Label:        `Default Response Charset`,
						Comment:      `If empty, UTF-8 will be used.`,
						Type:         config.TypeText,
						SortOrder:    10,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil,
						SourceModel:  nil,
					},
				},
			},
		},
	},
)
开发者ID:levcom,项目名称:csfw,代码行数:32,代码来源:config_webapi.go

示例11:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "checkout",
		Label:     "",
		SortOrder: 305,
		Scope:     scope.PermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "cart",
				Label:     ``,
				Comment:   ``,
				SortOrder: 2,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `checkout/cart/grouped_product_image`,
						ID:           "grouped_product_image",
						Label:        `Grouped Product Image`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    3,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `itself`,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Catalog\Model\Config\Source\Product\Thumbnail
					},
				},
			},
		},
	},
)
开发者ID:levcom,项目名称:csfw,代码行数:32,代码来源:config_groupedproduct.go

示例12:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "customer",
		Label:     "",
		SortOrder: 130,
		Scope:     scope.PermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "online_customers",
				Label:     `Online Customers Options`,
				Comment:   ``,
				SortOrder: 10,
				Scope:     scope.NewPerm(config.IDScopeDefault),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `customer/online_customers/online_minutes_interval`,
						ID:           "online_minutes_interval",
						Label:        `Online Minutes Interval`,
						Comment:      `Leave empty for default (15 minutes).`,
						Type:         config.TypeText,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(config.IDScopeDefault),
						Default:      nil,
						BackendModel: nil,
						// SourceModel:  nil,
					},
				},
			},
		},
	},
	&config.Section{
		ID:        "system",
		Label:     "",
		SortOrder: 0,
		Scope:     scope.NewPerm(),
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "log",
				Label:     `Log Cleaning`,
				Comment:   ``,
				SortOrder: 200,
				Scope:     scope.NewPerm(config.IDScopeDefault),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `system/log/clean_after_day`,
						ID:           "clean_after_day",
						Label:        `Save Log, Days`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(config.IDScopeDefault),
						Default:      180,
						BackendModel: nil,
						// SourceModel:  nil,
					},

					&config.Field{
						// Path: `system/log/enabled`,
						ID:           "enabled",
						Label:        `Enable Log Cleaning`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(config.IDScopeDefault),
						Default:      false,
						BackendModel: nil,
						// SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `system/log/time`,
						ID:           "time",
						Label:        `Start Time`,
						Comment:      ``,
						Type:         config.TypeTime,
						SortOrder:    3,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(config.IDScopeDefault),
						Default:      nil,
						BackendModel: nil,
						// SourceModel:  nil,
					},

					&config.Field{
						// Path: `system/log/frequency`,
						ID:           "frequency",
						Label:        `Frequency`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    4,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(config.IDScopeDefault),
						Default:      `D`,
						BackendModel: nil, // Magento\Config\Model\Config\Backend\Log\Cron
						// SourceModel:  nil, // Magento\Cron\Model\Config\Source\Frequency
					},

//.........这里部分代码省略.........
开发者ID:joao-parana,项目名称:csfw,代码行数:101,代码来源:config_log.go

示例13:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "rss",
		Label:     "RSS Feeds",
		SortOrder: 80,
		Scope:     scope.PermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "config",
				Label:     `Rss Config`,
				Comment:   ``,
				SortOrder: 1,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `rss/config/active`,
						ID:           "active",
						Label:        `Enable RSS`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    10,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      nil,
						BackendModel: nil, // Magento\Rss\Model\System\Config\Backend\Links
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Enabledisable
					},
				},
			},
		},
	},
)
开发者ID:levcom,项目名称:csfw,代码行数:32,代码来源:config_rss.go

示例14:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "sitemap",
		Label:     "XML Sitemap",
		SortOrder: 70,
		Scope:     scope.PermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "category",
				Label:     `Categories Options`,
				Comment:   ``,
				SortOrder: 1,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `sitemap/category/changefreq`,
						ID:           "changefreq",
						Label:        `Frequency`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `daily`,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Sitemap\Model\Config\Source\Frequency
					},

					&config.Field{
						// Path: `sitemap/category/priority`,
						ID:           "priority",
						Label:        `Priority`,
						Comment:      `Valid values range from 0.0 to 1.0.`,
						Type:         config.TypeText,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      0.5,
						BackendModel: nil, // Magento\Sitemap\Model\Config\Backend\Priority
						SourceModel:  nil,
					},
				},
			},

			&config.Group{
				ID:        "product",
				Label:     `Products Options`,
				Comment:   ``,
				SortOrder: 2,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `sitemap/product/changefreq`,
						ID:           "changefreq",
						Label:        `Frequency`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `daily`,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Sitemap\Model\Config\Source\Frequency
					},

					&config.Field{
						// Path: `sitemap/product/priority`,
						ID:           "priority",
						Label:        `Priority`,
						Comment:      `Valid values range from 0.0 to 1.0.`,
						Type:         config.TypeText,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      1,
						BackendModel: nil, // Magento\Sitemap\Model\Config\Backend\Priority
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `sitemap/product/image_include`,
						ID:           "image_include",
						Label:        `Add Images into Sitemap`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    3,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `all`,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Sitemap\Model\Source\Product\Image\IncludeImage
					},
				},
			},

			&config.Group{
				ID:        "page",
				Label:     `CMS Pages Options`,
				Comment:   ``,
				SortOrder: 3,
//.........这里部分代码省略.........
开发者ID:levcom,项目名称:csfw,代码行数:101,代码来源:config_sitemap.go

示例15:

var PackageConfiguration = config.MustNewConfiguration(
	&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:levcom,项目名称:csfw,代码行数:101,代码来源:config_authorizenet.go


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