本文整理汇总了Golang中github.com/corestoreio/csfw/store/scope.NewPerm函数的典型用法代码示例。如果您正苦于以下问题:Golang NewPerm函数的具体用法?Golang NewPerm怎么用?Golang NewPerm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewPerm函数的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)
}
示例2: 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)
}
示例3: 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
},
},
},
},
)
}
示例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)
}
示例5: 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)
}
示例6: 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)
}
示例7: TestBasePathInScope
func TestBasePathInScope(t *testing.T) {
t.Parallel()
tests := []struct {
sg config.ScopedGetter
p scope.Perm
wantErr error
}{
{
config.NewMockGetter().NewScoped(0, 0, 0),
scope.NewPerm(scope.DefaultID, scope.WebsiteID),
nil,
},
{
config.NewMockGetter().NewScoped(0, 0, 4),
scope.NewPerm(scope.StoreID),
nil,
},
{
config.NewMockGetter().NewScoped(0, 4, 0),
scope.NewPerm(scope.StoreID),
errors.New("Scope permission insufficient: Have 'Group'; Want 'Store'"),
},
}
for _, test := range tests {
p1 := NewPath("a/b/c", WithField(&element.Field{
Scope: test.p,
}))
haveErr := p1.InScope(test.sg)
if test.wantErr != nil {
assert.EqualError(t, haveErr, test.wantErr.Error())
} else {
assert.NoError(t, haveErr)
}
}
}
示例8: 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)
}
示例9: init
func init() {
ConfigStructure = element.MustNewConfiguration(
&element.Section{
ID: "promo",
Label: `Promotions`,
SortOrder: 400,
Scope: scope.NewPerm(scope.DefaultID),
Resource: 0, // Otnegam_SalesRule::config_promo
Groups: element.NewGroupSlice(
&element.Group{
ID: "auto_generated_coupon_codes",
Label: `Auto Generated Specific Coupon Codes`,
SortOrder: 10,
Scope: scope.NewPerm(scope.DefaultID),
Fields: element.NewFieldSlice(
&element.Field{
// Path: promo/auto_generated_coupon_codes/length
ID: "length",
Label: `Code Length`,
Comment: element.LongText(`Excluding prefix, suffix and separators.`),
Type: element.TypeText,
SortOrder: 10,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
Default: 12,
},
&element.Field{
// Path: promo/auto_generated_coupon_codes/format
ID: "format",
Label: `Code Format`,
Type: element.TypeSelect,
SortOrder: 20,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
Default: true,
// SourceModel: Otnegam\SalesRule\Model\System\Config\Source\Coupon\Format
},
&element.Field{
// Path: promo/auto_generated_coupon_codes/prefix
ID: "prefix",
Label: `Code Prefix`,
Type: element.TypeText,
SortOrder: 30,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
},
&element.Field{
// Path: promo/auto_generated_coupon_codes/suffix
ID: "suffix",
Label: `Code Suffix`,
Type: element.TypeText,
SortOrder: 40,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
},
&element.Field{
// Path: promo/auto_generated_coupon_codes/dash
ID: "dash",
Label: `Dash Every X Characters`,
Comment: element.LongText(`If empty no separation.`),
Type: element.TypeText,
SortOrder: 50,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
},
),
},
),
},
&element.Section{
ID: "rss",
Groups: element.NewGroupSlice(
&element.Group{
ID: "catalog",
Fields: element.NewFieldSlice(
&element.Field{
// Path: rss/catalog/discounts
ID: "discounts",
Label: `Coupons/Discounts`,
Type: element.TypeSelect,
SortOrder: 12,
Visible: element.VisibleYes,
Scope: scope.PermAll,
// SourceModel: Otnegam\Config\Model\Config\Source\Enabledisable
},
),
},
),
},
)
Backend = NewBackend(ConfigStructure)
}
示例10: init
func init() {
ConfigStructure = element.MustNewConfiguration(
&element.Section{
ID: "cataloginventory",
Label: `Inventory`,
SortOrder: 50,
Scope: scope.PermAll,
Resource: 0, // Otnegam_CatalogInventory::cataloginventory
Groups: element.NewGroupSlice(
&element.Group{
ID: "options",
Label: `Stock Options`,
SortOrder: 1,
Scope: scope.PermAll,
Fields: element.NewFieldSlice(
&element.Field{
// Path: cataloginventory/options/can_subtract
ID: "can_subtract",
Label: `Decrease Stock When Order is Placed`,
Type: element.TypeSelect,
SortOrder: 2,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
Default: true,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
&element.Field{
// Path: cataloginventory/options/can_back_in_stock
ID: "can_back_in_stock",
Label: `Set Items' Status to be In Stock When Order is Cancelled`,
Type: element.TypeSelect,
SortOrder: 2,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
Default: true,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
&element.Field{
// Path: cataloginventory/options/show_out_of_stock
ID: "show_out_of_stock",
Label: `Display Out of Stock Products`,
Comment: element.LongText(`Products will still be shown by direct product URLs.`),
Type: element.TypeSelect,
SortOrder: 3,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
Default: false,
// BackendModel: Otnegam\CatalogInventory\Model\Config\Backend\ShowOutOfStock
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
&element.Field{
// Path: cataloginventory/options/stock_threshold_qty
ID: "stock_threshold_qty",
Label: `Only X left Threshold`,
Type: element.TypeText,
SortOrder: 4,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
},
&element.Field{
// Path: cataloginventory/options/display_product_stock_status
ID: "display_product_stock_status",
Label: `Display Products Availability in Stock on Storefront`,
Type: element.TypeSelect,
SortOrder: 50,
Visible: element.VisibleYes,
Scope: scope.PermAll,
Default: true,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
),
},
&element.Group{
ID: "item_options",
Label: `Product Stock Options`,
Comment: element.LongText(`Please note that these settings apply to individual items in the cart, not to the entire cart.`),
SortOrder: 10,
Scope: scope.PermAll,
Fields: element.NewFieldSlice(
&element.Field{
// Path: cataloginventory/item_options/manage_stock
ID: "manage_stock",
Label: `Manage Stock`,
Comment: element.LongText(`Changing can take some time due to processing whole catalog.`),
Type: element.TypeSelect,
SortOrder: 1,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
Default: true,
// BackendModel: Otnegam\CatalogInventory\Model\Config\Backend\Managestock
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
&element.Field{
// Path: cataloginventory/item_options/backorders
//.........这里部分代码省略.........
示例11: init
func init() {
ConfigStructure = element.MustNewConfiguration(
&element.Section{
ID: "carriers",
Groups: element.NewGroupSlice(
&element.Group{
ID: "dhl",
Label: `DHL`,
SortOrder: 140,
Scope: scope.PermAll,
Fields: element.NewFieldSlice(
&element.Field{
// Path: carriers/dhl/active
ID: "active",
Label: `Enabled for Checkout`,
Type: element.TypeSelect,
SortOrder: 10,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: false,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
&element.Field{
// Path: carriers/dhl/active_rma
ID: "active_rma",
Label: `Enabled for RMA`,
Type: element.TypeSelect,
SortOrder: 15,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: false,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
&element.Field{
// Path: carriers/dhl/gateway_url
ID: "gateway_url",
Label: `Gateway URL`,
Type: element.TypeText,
SortOrder: 20,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: `https://xmlpi-ea.dhl.com/XMLShippingServlet`,
},
&element.Field{
// Path: carriers/dhl/title
ID: "title",
Label: `Title`,
Type: element.TypeText,
SortOrder: 20,
Visible: element.VisibleYes,
Scope: scope.PermAll,
Default: `DHL`,
},
&element.Field{
// Path: carriers/dhl/id
ID: "id",
Label: `Access ID`,
Type: element.TypeObscure,
SortOrder: 50,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: nil,
// BackendModel: Otnegam\Config\Model\Config\Backend\Encrypted @todo Otnegam\Config\Model\Config\Backend\Encrypted
},
&element.Field{
// Path: carriers/dhl/password
ID: "password",
Label: `Password`,
Type: element.TypeObscure,
SortOrder: 60,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: nil,
// BackendModel: Otnegam\Config\Model\Config\Backend\Encrypted @todo Otnegam\Config\Model\Config\Backend\Encrypted
},
&element.Field{
// Path: carriers/dhl/account
ID: "account",
Label: `Account Number`,
Type: element.TypeText,
SortOrder: 70,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
},
&element.Field{
// Path: carriers/dhl/content_type
ID: "content_type",
Label: `Content Type`,
Type: element.TypeSelect,
SortOrder: 90,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: `N`,
//.........这里部分代码省略.........
示例12:
"github.com/corestoreio/csfw/store/scope"
)
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,
},
},
示例13: init
func init() {
ConfigStructure = element.MustNewConfiguration(
&element.Section{
ID: "persistent",
Label: `Persistent Shopping Cart`,
SortOrder: 500,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Resource: 0, // Otnegam_Persistent::persistent
Groups: element.NewGroupSlice(
&element.Group{
ID: "options",
Label: `General Options`,
SortOrder: 10,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Fields: element.NewFieldSlice(
&element.Field{
// Path: persistent/options/enabled
ID: "enabled",
Label: `Enable Persistence`,
Type: element.TypeSelect,
SortOrder: 10,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: false,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
&element.Field{
// Path: persistent/options/lifetime
ID: "lifetime",
Label: `Persistence Lifetime (seconds)`,
Type: element.TypeText,
SortOrder: 20,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: 31536000,
},
&element.Field{
// Path: persistent/options/remember_enabled
ID: "remember_enabled",
Label: `Enable "Remember Me"`,
Type: element.TypeSelect,
SortOrder: 30,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: true,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
&element.Field{
// Path: persistent/options/remember_default
ID: "remember_default",
Label: `"Remember Me" Default Value`,
Type: element.TypeSelect,
SortOrder: 40,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: true,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
&element.Field{
// Path: persistent/options/logout_clear
ID: "logout_clear",
Label: `Clear Persistence on Sign Out`,
Type: element.TypeSelect,
SortOrder: 50,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: true,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
&element.Field{
// Path: persistent/options/shopping_cart
ID: "shopping_cart",
Label: `Persist Shopping Cart`,
Type: element.TypeSelect,
SortOrder: 60,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID, scope.WebsiteID),
Default: true,
// SourceModel: Otnegam\Config\Model\Config\Source\Yesno
},
),
},
),
},
)
Backend = NewBackend(ConfigStructure)
}
示例14: init
func init() {
ConfigStructure = element.MustNewConfiguration(
&element.Section{
ID: "catalog",
Label: `Catalog`,
SortOrder: 40,
Scope: scope.PermAll,
Resource: 0, // Otnegam_Catalog::config_catalog
Groups: element.NewGroupSlice(
&element.Group{
ID: "fields_masks",
Label: `Product Fields Auto-Generation`,
SortOrder: 90,
Scope: scope.PermAll,
Fields: element.NewFieldSlice(
&element.Field{
// Path: catalog/fields_masks/sku
ID: "sku",
Label: `Mask for SKU`,
Comment: element.LongText(`Use {{name}} as Product Name placeholder`),
Type: element.TypeText,
SortOrder: 10,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
Default: `{{name}}`,
},
&element.Field{
// Path: catalog/fields_masks/meta_title
ID: "meta_title",
Label: `Mask for Meta Title`,
Comment: element.LongText(`Use {{name}} as Product Name placeholder`),
Type: element.TypeText,
SortOrder: 20,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
Default: `{{name}}`,
},
&element.Field{
// Path: catalog/fields_masks/meta_keyword
ID: "meta_keyword",
Label: `Mask for Meta Keywords`,
Comment: element.LongText(`Use {{name}} as Product Name or {{sku}} as Product SKU placeholders`),
Type: element.TypeText,
SortOrder: 30,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
Default: `{{name}}`,
},
&element.Field{
// Path: catalog/fields_masks/meta_description
ID: "meta_description",
Label: `Mask for Meta Description`,
Comment: element.LongText(`Use {{name}} and {{description}} as Product Name and Product Description placeholders`),
Type: element.TypeText,
SortOrder: 40,
Visible: element.VisibleYes,
Scope: scope.NewPerm(scope.DefaultID),
Default: `{{name}} {{description}}`,
},
),
},
&element.Group{
ID: "frontend",
Label: `Storefront`,
SortOrder: 100,
Scope: scope.PermAll,
Fields: element.NewFieldSlice(
&element.Field{
// Path: catalog/frontend/list_mode
ID: "list_mode",
Label: `List Mode`,
Type: element.TypeSelect,
SortOrder: 1,
Visible: element.VisibleYes,
Scope: scope.PermAll,
Default: `grid-list`,
// SourceModel: Otnegam\Catalog\Model\Config\Source\ListMode
},
&element.Field{
// Path: catalog/frontend/grid_per_page_values
ID: "grid_per_page_values",
Label: `Products per Page on Grid Allowed Values`,
Comment: element.LongText(`Comma-separated.`),
Type: element.TypeText,
SortOrder: 2,
Visible: element.VisibleYes,
Scope: scope.PermAll,
Default: `9,15,30`,
},
&element.Field{
// Path: catalog/frontend/grid_per_page
ID: "grid_per_page",
Label: `Products per Page on Grid Default Value`,
Comment: element.LongText(`Must be in the allowed values list`),
//.........这里部分代码省略.........
示例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{
//.........这里部分代码省略.........