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


Golang element.NewFieldSlice函数代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例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:        "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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例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.NewFieldSlice函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。