webexcess / supertypes-plus
此包已被废弃,不再维护。未建议替代包。
修改每个 SuperType-Definition 的 Mixins
0.1.1
2018-02-06 06:23 UTC
Requires
- neos/content-repository: ~3.3.0
This package is not auto-updated.
Last update: 2020-01-18 10:01:28 UTC
README
Neos SuperTypes 允许您将多个节点类型定义(称为 Mixins)组合在一起。这很棒,直到您遇到重叠的属性名称。
使用此包,您可以修改每个 SuperType-Definition 的 Mixins。
安装
composer require webexcess/supertypes-plus
示例
Mixin 源
'Vendor.Package:ImageMixin': abstract: true ui: inspector: groups: image: label: i18n icon: icon-picture properties: image: type: Neos\Media\Domain\Model\ImageInterface ui: label: i18n inspector: group: image position: 100 caption: type: string ui: label: i18n inspector: group: image position: 200
节点类型使用
'Vendor.Package:ImageCollage': superTypes: 'Neos.Neos:Content': true 'Vendor.Package:ImageMixin': - properties: '*': 'left*' - ui: false properties: '*': 'right*' ui: label: i18n icon: icon-picture properties: rightImage: ui: inspector: position: 300 rightCaption: ui: inspector: position: 400
生成结果
'Vendor.Package:ImageCollage': superTypes: 'Neos.Neos:Content': true 'Vendor.Package:ImageMixin-9073ec087c07c8365a776639b521c38a6688dbf7': true 'Vendor.Package:ImageMixin-f6dc591593ef2c992ef29315ad58bf07a2b565a5': true ui: label: i18n icon: icon-picture properties: rightImage: ui: inspector: position: 300 rightCaption: ui: inspector: position: 400 # Autogenerated Mixin of the first SuperType-Modification.. 'Vendor.Package:ImageMixin-9073ec087c07c8365a776639b521c38a6688dbf7': abstract: true ui: inspector: groups: image: label: 'Vendor.Package:NodeTypes.ImageMixin:groups.image' icon: icon-picture properties: leftImage: type: Neos\Media\Domain\Model\ImageInterface ui: label: 'Vendor.Package:NodeTypes.ImageMixin:properties.image' inspector: group: image position: 100 leftCaption: type: string ui: label: 'Vendor.Package:NodeTypes.ImageMixin:properties.caption' inspector: group: image position: 200 # Autogenerated Mixin of the second SuperType-Modification.. 'Vendor.Package:ImageMixin-f6dc591593ef2c992ef29315ad58bf07a2b565a5': abstract: true properties: rightImage: type: Neos\Media\Domain\Model\ImageInterface ui: label: 'Vendor.Package:NodeTypes.ImageMixin:properties.image' inspector: group: image position: 100 rightCaption: type: string ui: label: 'Vendor.Package:NodeTypes.ImageMixin:properties.caption' inspector: group: image position: 200
使用方法
# Original.. 'Vendor.Package:NodeType': superTypes: 'Vendor.Package:MixinA': true 'Vendor.Package:MixinB': false # Disable just a small part.. 'Vendor.Package:NodeType': superTypes: 'Vendor.Package:MixinA': {ui: false} 'Vendor.Package:MixinB': ui: false # Give the generated SuperTypes a name.. 'Vendor.Package:NodeType': superTypes: 'Vendor.Package:Mixin': _name: 'Vendor.Package:Mixin-WithoutUI' ui: false # Rename and/or disable some properties.. 'Vendor.Package:NodeType': superTypes: 'Vendor.Package:Mixin': properties: 'propertyA': 'newPropertyA' 'propertyB': false # Rename all properties with a pre and/or suffix.. 'Vendor.Package:NodeType': superTypes: 'Vendor.Package:Mixin': properties: '*': 'prefix*Suffix' # Use one mixin multiple times with renamed properties.. 'Vendor.Package:NodeType': superTypes: 'Vendor.Package:Mixin': - properties: 'property': 'newPropertyA' - properties: 'property': 'newPropertyB' # Use one mixin multiple times with renamed properties and keep the original one.. 'Vendor.Package:NodeType': superTypes: 'Vendor.Package:Mixin': - properties: 'property': 'newPropertyA' - '*': true
原则
- 此包允许从现有 Mixins 中生成动态 Mixins,但其中包含重命名或禁用部分。
- 只有当需要重命名、删除、重复或保留原始 i18n 翻译时才会更改值。
- 其他所有操作都必须在该节点类型定义的正确位置进行。
待办事项
- 在 ui 设置中自动进行组重命名以及对应属性的重命名
- 如果某个 Mixins 被多次使用,则自动重新定位属性
- 测试
由 webexcess GmbH 开发