本文整理汇总了Golang中github.com/corestoreio/csfw/config/element.NewGroupSlice函数的典型用法代码示例。如果您正苦于以下问题:Golang NewGroupSlice函数的具体用法?Golang NewGroupSlice怎么用?Golang NewGroupSlice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewGroupSlice函数的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)
}
示例2: 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)
}
示例3: 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)
}
示例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)
}
示例5: 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)
}
示例6: 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)
}
示例7: 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)
}
示例8: 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)
}
示例9: 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)
}
示例10: 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())
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例15: init
func init() {
ConfigStructure = element.MustNewConfiguration(
&element.Section{
ID: "design",
Groups: element.NewGroupSlice(
&element.Group{
ID: "head",
Label: `HTML Head`,
SortOrder: 20,
Scope: scope.PermAll,
Fields: element.NewFieldSlice(
&element.Field{
// Path: design/head/shortcut_icon
ID: "shortcut_icon",
Label: `Favicon Icon`,
Comment: element.LongText(`Allowed file types: ICO, PNG, GIF, JPG, JPEG, APNG, SVG. Not all browsers support all these formats!`),
Type: element.TypeImage,
SortOrder: 5,
Visible: element.VisibleYes,
Scope: scope.PermAll,
// BackendModel: Otnegam\Config\Model\Config\Backend\Image\Favicon
},
&element.Field{
// Path: design/head/default_title
ID: "default_title",
Label: `Default Title`,
Type: element.TypeText,
SortOrder: 10,
Visible: element.VisibleYes,
Scope: scope.PermAll,
},
&element.Field{
// Path: design/head/title_prefix
ID: "title_prefix",
Label: `Title Prefix`,
Type: element.TypeText,
SortOrder: 12,
Visible: element.VisibleYes,
Scope: scope.PermAll,
},
&element.Field{
// Path: design/head/title_suffix
ID: "title_suffix",
Label: `Title Suffix`,
Type: element.TypeText,
SortOrder: 14,
Visible: element.VisibleYes,
Scope: scope.PermAll,
},
&element.Field{
// Path: design/head/default_description
ID: "default_description",
Label: `Default Description`,
Type: element.TypeTextarea,
SortOrder: 20,
Visible: element.VisibleYes,
Scope: scope.PermAll,
},
&element.Field{
// Path: design/head/default_keywords
ID: "default_keywords",
Label: `Default Keywords`,
Type: element.TypeTextarea,
SortOrder: 30,
Visible: element.VisibleYes,
Scope: scope.PermAll,
},
&element.Field{
// Path: design/head/includes
ID: "includes",
Label: `Miscellaneous Scripts`,
Comment: element.LongText(`This will be included before head closing tag in page HTML.`),
Type: element.TypeTextarea,
SortOrder: 70,
Visible: element.VisibleYes,
Scope: scope.PermAll,
},
&element.Field{
// Path: design/head/demonotice
ID: "demonotice",
Label: `Display Demo Store Notice`,
Type: element.TypeSelect,
SortOrder: 80,
Visible: element.VisibleYes,
Scope: scope.PermAll,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
),
},
&element.Group{
ID: "search_engine_robots",
Label: `Search Engine Robots`,
//.........这里部分代码省略.........