當前位置: 首頁>>代碼示例>>Golang>>正文


Golang element.MustNewConfiguration函數代碼示例

本文整理匯總了Golang中github.com/corestoreio/csfw/config/element.MustNewConfiguration函數的典型用法代碼示例。如果您正苦於以下問題:Golang MustNewConfiguration函數的具體用法?Golang MustNewConfiguration怎麽用?Golang MustNewConfiguration使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了MustNewConfiguration函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID: "catalog",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID:        "review",
					Label:     `Product Reviews`,
					SortOrder: 100,
					Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: catalog/review/allow_guest
							ID:        "allow_guest",
							Label:     `Allow Guests to Write Reviews`,
							Type:      element.TypeSelect,
							SortOrder: 1,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
							Default:   true,
							// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:29,代碼來源:config_review.go

示例2: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID: "checkout",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID: "options",
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: checkout/options/enable_agreements
							ID:        "enable_agreements",
							Label:     `Enable Terms and Conditions`,
							Type:      element.TypeSelect,
							SortOrder: 20,
							Visible:   element.VisibleYes,
							Scope:     scope.PermAll,
							// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:25,代碼來源:config_checkoutagreements.go

示例3: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID: "catalog",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID: "search",
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: catalog/search/engine
							ID:        "engine",
							Label:     `Search Engine`,
							Type:      element.TypeSelect,
							SortOrder: 19,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID),
							// SourceModel: Otnegam\Search\Model\Adminhtml\System\Config\Source\Engine
						},

						&element.Field{
							// Path: catalog/search/search_type
							ID:      "search_type",
							Type:    element.Type,
							Visible: element.VisibleYes,
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:32,代碼來源:config_search.go

示例4: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID:        "webapi",
			Label:     `Otnegam Web API`,
			SortOrder: 102,
			Scope:     scope.PermAll,
			Resource:  0, // Otnegam_Webapi::config_webapi
			Groups: element.NewGroupSlice(
				&element.Group{
					ID:        "soap",
					Label:     `SOAP Settings`,
					SortOrder: 1,
					Scope:     scope.PermAll,
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: webapi/soap/charset
							ID:        "charset",
							Label:     `Default Response Charset`,
							Comment:   element.LongText(`If empty, UTF-8 will be used.`),
							Type:      element.TypeText,
							SortOrder: 10,
							Visible:   element.VisibleYes,
							Scope:     scope.PermAll,
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:32,代碼來源:config_webapi.go

示例5: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID: "checkout",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID: "cart",
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: checkout/cart/configurable_product_image
							ID:        "configurable_product_image",
							Label:     `Configurable Product Image`,
							Type:      element.TypeSelect,
							SortOrder: 4,
							Visible:   element.VisibleYes,
							Scope:     scope.PermAll,
							Default:   `parent`,
							// SourceModel: Otnegam\Catalog\Model\Config\Source\Product\Thumbnail
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:26,代碼來源:config_configurableproduct.go

示例6: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID:        "rss",
			Label:     `RSS Feeds`,
			SortOrder: 80,
			Scope:     scope.PermAll,
			Resource:  0, // Otnegam_Rss::rss
			Groups: element.NewGroupSlice(
				&element.Group{
					ID:        "config",
					Label:     `Rss Config`,
					SortOrder: 1,
					Scope:     scope.PermAll,
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: rss/config/active
							ID:        "active",
							Label:     `Enable RSS`,
							Type:      element.TypeSelect,
							SortOrder: 10,
							Visible:   element.VisibleYes,
							Scope:     scope.PermAll,
							// BackendModel: Otnegam\Rss\Model\System\Config\Backend\Links
							// SourceModel: Otnegam\Config\Model\Config\Source\Enabledisable
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:33,代碼來源:config_rss.go

示例7: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID: "payment",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID:        "vault",
					Label:     `Vault Provider`,
					SortOrder: 2,
					Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: payment/vault/vault_payment
							ID:      "vault_payment",
							Label:   `Vault Provider`,
							Comment: element.LongText(`Specified provider should be enabled.`),
							Type:    element.TypeSelect,
							Visible: element.VisibleYes,
							Scope:   scope.NewPerm(scope.DefaultID, scope.WebsiteID),
							// SourceModel: Otnegam\Vault\Model\Adminhtml\Source\VaultProvidersMap
						},
					),
				},
			),
		},

		// Hidden Configuration, may be visible somewhere else ...
		&element.Section{
			ID: "payment",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID: "vault",
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: payment/vault/debug
							ID:      `debug`,
							Type:    element.TypeHidden,
							Visible: element.VisibleNo,
							Default: true,
						},

						&element.Field{
							// Path: payment/vault/model
							ID:      `model`,
							Type:    element.TypeHidden,
							Visible: element.VisibleNo,
							Default: `Otnegam\Vault\Model\VaultPaymentInterface`,
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:55,代碼來源:config_vault.go

示例8: TestScopeApplyDefaults

func TestScopeApplyDefaults(t *testing.T) {
	defer debugLogBuf.Reset()
	defer infoLogBuf.Reset()

	pkgCfg := element.MustNewConfiguration(
		&element.Section{
			ID: "contact",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID: "contact",
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: `contact/contact/enabled`,
							ID:      "enabled",
							Default: true,
						},
					),
				},
				&element.Group{
					ID: "email",
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: `contact/email/recipient_email`,
							ID:      "recipient_email",
							Default: `[email protected]`,
						},
						&element.Field{
							// Path: `contact/email/sender_email_identity`,
							ID:      "sender_email_identity",
							Default: 2.7182818284590452353602874713527,
						},
						&element.Field{
							// Path: `contact/email/email_template`,
							ID:      "email_template",
							Default: 4711,
						},
					),
				},
			),
		},
	)
	s := config.NewService()
	s.ApplyDefaults(pkgCfg)
	cer, err := pkgCfg.FindFieldByPath("contact", "email", "recipient_email")
	if err != nil {
		t.Error(err)
		return
	}
	sval, err := s.String(config.Path("contact/email/recipient_email"))
	assert.NoError(t, err)
	assert.Exactly(t, cer.Default.(string), sval)
	assert.NoError(t, s.Close())
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:53,代碼來源:service_test.go

示例9: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID:        "catalog",
			SortOrder: 40,
			Scope:     scope.PermAll,
			Groups: element.NewGroupSlice(
				&element.Group{
					ID:        "frontend",
					SortOrder: 100,
					Scope:     scope.PermAll,
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: catalog/frontend/swatches_per_product
							ID:        "swatches_per_product",
							Label:     `Swatches per Product`,
							Type:      element.TypeText,
							SortOrder: 300,
							Visible:   element.VisibleYes,
							Scope:     scope.PermAll,
							Default:   16,
						},
					),
				},
			),
		},

		// Hidden Configuration, may be visible somewhere else ...
		&element.Section{
			ID: "general",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID: "validator_data",
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: general/validator_data/input_types
							ID:      `input_types`,
							Type:    element.TypeHidden,
							Visible: element.VisibleNo,
							Default: `{"swatch_visual":"swatch_visual","swatch_text":"swatch_text"}`,
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:48,代碼來源:config_swatches.go

示例10: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID: "system",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID:        "cron",
					Label:     `Cron (Scheduled Tasks) - all the times are in minutes`,
					Comment:   element.LongText(`For correct URLs generated during cron runs please make sure that Web > Secure and Unsecure Base URLs are explicitly set.`),
					SortOrder: 15,
					Scope:     scope.NewPerm(scope.DefaultID),
					Fields:    element.NewFieldSlice(),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:18,代碼來源:config_cron.go

示例11: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID:        "multishipping",
			Label:     `Multishipping Settings`,
			SortOrder: 311,
			Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
			Resource:  0, // Otnegam_Multishipping::config_multishipping
			Groups: element.NewGroupSlice(
				&element.Group{
					ID:        "options",
					Label:     `Options`,
					SortOrder: 2,
					Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: multishipping/options/checkout_multiple
							ID:        "checkout_multiple",
							Label:     `Allow Shipping to Multiple Addresses`,
							Type:      element.TypeSelect,
							SortOrder: 1,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
							Default:   true,
							// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
						},

						&element.Field{
							// Path: multishipping/options/checkout_multiple_maximum_qty
							ID:        "checkout_multiple_maximum_qty",
							Label:     `Maximum Qty Allowed for Shipping to Multiple Addresses`,
							Type:      element.TypeText,
							SortOrder: 2,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
							Default:   100,
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:44,代碼來源:config_multishipping.go

示例12: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID: "google",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID: "analytics",
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: google/analytics/experiments
							ID:        "experiments",
							Label:     `Enable Content Experiments`,
							Type:      element.TypeSelect,
							SortOrder: 30,
							Visible:   element.VisibleYes,
							Scope:     scope.PermAll,
							// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
						},
					),
				},
			),
		},

		// Hidden Configuration, may be visible somewhere else ...
		&element.Section{
			ID: "google",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID: "optimizer",
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: google/optimizer/active
							ID:      `active`,
							Type:    element.TypeHidden,
							Visible: element.VisibleNo,
							Default: false,
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:44,代碼來源:config_googleoptimizer.go

示例13: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID:        "google",
			Label:     `Google API`,
			SortOrder: 340,
			Scope:     scope.PermAll,
			Resource:  0, // Otnegam_GoogleAnalytics::google
			Groups: element.NewGroupSlice(
				&element.Group{
					ID:        "analytics",
					Label:     `Google Analytics`,
					SortOrder: 10,
					Scope:     scope.PermAll,
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: google/analytics/active
							ID:        "active",
							Label:     `Enable`,
							Type:      element.TypeSelect,
							SortOrder: 10,
							Visible:   element.VisibleYes,
							Scope:     scope.PermAll,
							// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
						},

						&element.Field{
							// Path: google/analytics/account
							ID:        "account",
							Label:     `Account Number`,
							Type:      element.TypeText,
							SortOrder: 20,
							Visible:   element.VisibleYes,
							Scope:     scope.PermAll,
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:42,代碼來源:config_googleanalytics.go

示例14: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID: "dev",
			Groups: element.NewGroupSlice(
				&element.Group{
					ID: "js",
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: dev/js/session_storage_logging
							ID:        "session_storage_logging",
							Label:     `Log JS Errors to Session Storage`,
							Comment:   element.LongText(`If enabled, can be used by functional tests for extended reporting`),
							Type:      element.TypeSelect,
							SortOrder: 100,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID),
							Default:   false,
							// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
						},

						&element.Field{
							// Path: dev/js/session_storage_key
							ID:        "session_storage_key",
							Label:     `Log JS Errors to Session Storage Key`,
							Comment:   element.LongText(`Use this key to retrieve collected js errors`),
							Type:      element.TypeText,
							SortOrder: 110,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID),
							Default:   `collected_errors`,
						},
					),
				},
			),
		},
	)
	Backend = NewBackend(ConfigStructure)
}
開發者ID:joao-parana,項目名稱:csfw,代碼行數:39,代碼來源:config_ui.go

示例15: init

func init() {
	ConfigStructure = element.MustNewConfiguration(
		&element.Section{
			ID:        "tax",
			Label:     `Tax`,
			SortOrder: 303,
			Scope:     scope.PermAll,
			Resource:  0, // Otnegam_Tax::config_tax
			Groups: element.NewGroupSlice(
				&element.Group{
					ID:        "classes",
					Label:     `Tax Classes`,
					SortOrder: 10,
					Scope:     scope.PermAll,
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: tax/classes/shipping_tax_class
							ID:        "shipping_tax_class",
							Label:     `Tax Class for Shipping`,
							Type:      element.TypeSelect,
							SortOrder: 10,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
							Default:   false,
							// SourceModel: Otnegam\Tax\Model\TaxClass\Source\Product
						},

						&element.Field{
							// Path: tax/classes/default_product_tax_class
							ID:        "default_product_tax_class",
							Label:     `Default Tax Class for Product`,
							Type:      element.TypeSelect,
							SortOrder: 20,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID),
							Default:   2,
							// BackendModel: Otnegam\Tax\Model\Config\TaxClass
							// SourceModel: Otnegam\Tax\Model\TaxClass\Source\Product
						},

						&element.Field{
							// Path: tax/classes/default_customer_tax_class
							ID:        "default_customer_tax_class",
							Label:     `Default Tax Class for Customer`,
							Type:      element.TypeSelect,
							SortOrder: 30,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID),
							Default:   3,
							// SourceModel: Otnegam\Tax\Model\TaxClass\Source\Customer
						},
					),
				},

				&element.Group{
					ID:        "calculation",
					Label:     `Calculation Settings`,
					SortOrder: 20,
					Scope:     scope.PermAll,
					Fields: element.NewFieldSlice(
						&element.Field{
							// Path: tax/calculation/algorithm
							ID:        "algorithm",
							Label:     `Tax Calculation Method Based On`,
							Type:      element.TypeSelect,
							SortOrder: 1,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
							Default:   `TOTAL_BASE_CALCULATION`,
							// SourceModel: Otnegam\Tax\Model\System\Config\Source\Algorithm
						},

						&element.Field{
							// Path: tax/calculation/based_on
							ID:        "based_on",
							Label:     `Tax Calculation Based On`,
							Type:      element.TypeSelect,
							SortOrder: 10,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
							Default:   `shipping`,
							// BackendModel: Otnegam\Tax\Model\Config\Notification
							// SourceModel: Otnegam\Tax\Model\Config\Source\Basedon
						},

						&element.Field{
							// Path: tax/calculation/price_includes_tax
							ID:        "price_includes_tax",
							Label:     `Catalog Prices`,
							Comment:   element.LongText(`This sets whether catalog prices entered from Otnegam Admin include tax.`),
							Type:      element.TypeSelect,
							SortOrder: 20,
							Visible:   element.VisibleYes,
							Scope:     scope.NewPerm(scope.DefaultID, scope.WebsiteID),
							Default:   false,
							// BackendModel: Otnegam\Tax\Model\Config\Price\IncludePrice
							// SourceModel: Otnegam\Tax\Model\System\Config\Source\PriceType
						},

						&element.Field{
//.........這裏部分代碼省略.........
開發者ID:joao-parana,項目名稱:csfw,代碼行數:101,代碼來源:config_tax.go


注:本文中的github.com/corestoreio/csfw/config/element.MustNewConfiguration函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。