• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang config.MustNewConfiguration函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "system",
		Label:     "",
		SortOrder: 0,
		Scope:     nil,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "adminnotification",
				Label:     `Notifications`,
				Comment:   ``,
				SortOrder: 250,
				Scope:     scope.NewPerm(scope.DefaultID),
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `system/adminnotification/use_https`,
						ID:           "use_https",
						Label:        `Use HTTPS to Get Feed`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      false,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `system/adminnotification/frequency`,
						ID:           "frequency",
						Label:        `Update Frequency`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      true,
						BackendModel: nil,
						SourceModel:  nil, // Magento\AdminNotification\Model\Config\Source\Frequency
					},

					&config.Field{
						// Path: `system/adminnotification/last_update`,
						ID:           "last_update",
						Label:        `Last Update`,
						Comment:      ``,
						Type:         config.TypeLabel,
						SortOrder:    3,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm(scope.DefaultID),
						Default:      0,
						BackendModel: nil,
						SourceModel:  nil,
					},
				},
			},
		},
	},

	// Hidden Configuration, may be visible somewhere else ...
	&config.Section{
		ID: "system",
		Groups: config.GroupSlice{
			&config.Group{
				ID: "adminnotification",
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `system/adminnotification/feed_url`,
						ID:      "feed_url",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: `notifications.magentocommerce.com/magento2/community/notifications.rss`,
					},

					&config.Field{
						// Path: `system/adminnotification/popup_url`,
						ID:      "popup_url",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: `widgets.magentocommerce.com/notificationPopup`,
					},

					&config.Field{
						// Path: `system/adminnotification/severity_icons_url`,
						ID:      "severity_icons_url",
						Type:    config.TypeHidden,
						Visible: config.VisibleNo,
						Scope:   scope.NewPerm(scope.DefaultID), // @todo search for that
						Default: `widgets.magentocommerce.com/%s/%s.gif`,
					},
				},
			},
		},
	},
)
开发者ID:levcom,项目名称:csfw,代码行数:98,代码来源:config_adminnotification.go


示例17:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "sendfriend",
		Label:     "Email to a Friend",
		SortOrder: 120,
		Scope:     scope.PermAll,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "email",
				Label:     `Email Templates`,
				Comment:   ``,
				SortOrder: 1,
				Scope:     scope.PermAll,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `sendfriend/email/enabled`,
						ID:           "enabled",
						Label:        `Enabled`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    1,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      true,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `sendfriend/email/template`,
						ID:           "template",
						Label:        `Select Email Template`,
						Comment:      `Email template chosen based on theme fallback when "Default" option is selected.`,
						Type:         config.TypeSelect,
						SortOrder:    2,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      `sendfriend_email_template`,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Email\Template
					},

					&config.Field{
						// Path: `sendfriend/email/allow_guest`,
						ID:           "allow_guest",
						Label:        `Allow for Guests`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    3,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      false,
						BackendModel: nil,
						SourceModel:  nil, // Magento\Config\Model\Config\Source\Yesno
					},

					&config.Field{
						// Path: `sendfriend/email/max_recipients`,
						ID:           "max_recipients",
						Label:        `Max Recipients`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    4,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      5,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `sendfriend/email/max_per_hour`,
						ID:           "max_per_hour",
						Label:        `Max Products Sent in 1 Hour`,
						Comment:      ``,
						Type:         config.TypeText,
						SortOrder:    5,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      5,
						BackendModel: nil,
						SourceModel:  nil,
					},

					&config.Field{
						// Path: `sendfriend/email/check_by`,
						ID:           "check_by",
						Label:        `Limit Sending By`,
						Comment:      ``,
						Type:         config.TypeSelect,
						SortOrder:    6,
						Visible:      config.VisibleYes,
						Scope:        scope.PermAll,
						Default:      false,
						BackendModel: nil,
						SourceModel:  nil, // Magento\SendFriend\Model\Source\Checktype
					},
				},
			},
		},
//.........这里部分代码省略.........
开发者ID:levcom,项目名称:csfw,代码行数:101,代码来源:config_sendfriend.go


示例18:

var PackageConfiguration = config.MustNewConfiguration(
	&config.Section{
		ID:        "dev",
		Label:     "",
		SortOrder: 0,
		Scope:     nil,
		Groups: config.GroupSlice{
			&config.Group{
				ID:        "js",
				Label:     ``,
				Comment:   ``,
				SortOrder: 0,
				Scope:     nil,
				Fields: config.FieldSlice{
					&config.Field{
						// Path: `dev/js/translate_strategy`,
						ID:           "translate_strategy",
						Label:        `Translation Strategy`,
						Comment:      `Please put your store into maintenance mode and redeploy static files after changing strategy`,
						Type:         config.TypeSelect,
						SortOrder:    30,
						Visible:      config.VisibleYes,
						Scope:        scope.NewPerm( 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang config.NewConfiguration函数代码示例发布时间:2022-05-23
下一篇:
Golang codegen.LogFatal函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap