tms / select
在 Neos CMS 中选择节点,而不是通过引用编辑器搜索
1.4.2
2022-04-21 18:02 UTC
Requires
- neos/neos: ^4.3 || ^5.0 || ^7.0 || ^8.0 || dev-master
README
在 Neos CMS 中选择节点,而不是通过引用编辑器搜索。
安装
composer require tms/select
使用方法
单选节点类型配置
'Your.Package:Type': properties: yourReference: type: reference ui: inspector: editor: 'Neos.Neos/Inspector/Editors/SelectBoxEditor' editorOptions: dataSourceIdentifier: 'tms-select-nodedata' dataSourceDisableCaching: true # see "Data source caching" dataSourceAdditionalData: nodeTypes: ['Your.Package:TypeThatShouldBeReferenced'] # Optional parameters groupBy: 'Your.Package:GroupType' startingPoint: '/start/here/instead/of/rootnode' labelPropertyName: 'title' setLabelPrefixByNodeContext: true previewPropertyName: 'thumbnailImage' # works with Neos 7.2+
多选调整
'Your.Package:Type': properties: yourReferences: type: references ui: inspector: editorOptions: multiple: true # Don't forget to set multiple: true when using type: references
可选参数
数据源缓存
默认情况下,Neos 会根据当前节点缓存数据源结果。对于 Tms.Select
,这种缓存行为并不理想,因为
- 数据源结果构建过于频繁
- 当引用节点更改时,在导航 UI(实际上,只有刷新浏览器时)时数据源结果不会刷新
我们通过实现数据源缓存 Tms_Select_DataSourceCache
来解决这个问题。为了确保数据源结果始终是最新的,您应该通过 dataSourceDisableCaching: true
禁用默认数据源缓存。
与 Sitegeist.Taxonomy 兼容
'Your.Package:Type': properties: yourTaxonomyReferences: type: references ui: inspector: editor: 'Neos.Neos/Inspector/Editors/SelectBoxEditor' editorOptions: allowEmpty: true multiple: true dataSourceIdentifier: 'tms-select-nodedata' dataSourceDisableCaching: true dataSourceAdditionalData: nodeTypes: [ 'Sitegeist.Taxonomy:Taxonomy' ] labelPropertyName: title startingPoint: '/taxonomies/your-vocabulary'
致谢
由 tms.development - Online Marketing and Neos CMS Agency 赞助开发