webexcess / basetypes
Neos 的基础 NodeTypes
1.1.0
2018-03-05 09:43 UTC
Requires
- flowpack/listable: *
- neos/flow: *
- neos/neos: 3.*
- neos/nodetypes: *
Conflicts
README
Neos CMS 的基础 NodeTypes。
安装
composer require webexcess/basetypes
兼容性和维护
可直接使用
内容 NodeTypes
- 标题
- 段落
- 响应式图片 (srcset)
- SVG-图片
- 按钮
- 响应式 Iframe
- 网格(两列、三列和四列)
文档 NodeTypes
- 主页
- 页面
规则
- 每个文件的第一个代码行都包含相应的 CSS 类的注释,例如
# basetype-paragraph
- 属性始终使用 BaseType 名称命名空间,例如
paragraphText
- 而不是只有text
结构
- 每个 NodeTypes 都由 Mixin 部分组成。对于段落,这些是
WebExcess.BaseTypes:Content
定义了 NodeTypes 作为内容元素WebExcess.BaseTypes:Paragraph.ui
使得 NodeTypes 在需要时可见的检查器组WebExcess.BaseTypes:Paragraph.properties.paragraphText--inplace
启用了 paragraphText 属性的 inplace 设置
- 每个属性都可用三种模式
WebExcess.BaseTypes:Paragraph.properties.paragraphText
基本属性设置WebExcess.BaseTypes:Paragraph.properties.paragraphText--inspector
.. 包括检查器设置WebExcess.BaseTypes:Paragraph.properties.paragraphText--inplace
.. 包括 inplace 设置
提示
- 使用
./flow site:import --package-key WebExcess.BaseTypes
导入初始内容
用法/扩展
BaseTypes 替换并扩展现有的 Neos NodeTypes,并允许您轻松构建和扩展自己的自定义 NodeTypes。
示例
在您的主题包中创建一个包含图片、可 inplace 编辑的标题和文本的 Teaser-NodeTypes。
NodeTypes.Teaser.yaml
'WebExcess.Theme:Teaser':
superTypes:
'WebExcess.BaseTypes:Content': true
'WebExcess.BaseTypes:Heading.ui': true
'WebExcess.BaseTypes:Heading.properties.headingText--inplace': true
'WebExcess.BaseTypes:Heading.properties.headingTagName--inspector': true
'WebExcess.BaseTypes:Paragraph.ui': true
'WebExcess.BaseTypes:Paragraph.properties.paragraphText--inplace': true
'WebExcess.BaseTypes:Image.ui': true
'WebExcess.BaseTypes:Image.properties.imageAsset--inspector': true
'WebExcess.BaseTypes:Button.properties.buttonUrl--inspector': true
'WebExcess.BaseTypes:Button.properties.buttonStyle': true
ui:
label: 'Teaser'
icon: icon-file-text-o
NodeTypes.Teaser.fusion
prototype(WebExcess.Theme:Teaser) >
prototype(WebExcess.Theme:Teaser) < prototype(WebExcess.BaseTypes:Image) {
content = Neos.Fusion:Array {
heading = WebExcess.BaseTypes:HeadingObject
heading.@position = 'after image'
text = WebExcess.BaseTypes:ParagraphObject
text.@position = 'after heading'
}
}
就这些了
思考
- "在很多情况下,复制粘贴比 DRY 更好... 坏抽象比没有抽象更糟糕。" Dmitri Pisarev
- "计算机科学中的任何问题都可以通过另一层间接解决。但这通常会引发另一个问题。" David Wheeler
由 webexcess GmbH 提供