arsors/globalcontent

一个NEOS扩展包,它添加了一个新的页面文档类型。它允许你创建全局内容,并从Fusion的任何地方读取它。

安装: 250

依赖: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 0

公开问题: 0

类型:neos-package

v3.0.0 2023-11-02 15:50 UTC

This package is auto-updated.

Last update: 2024-10-01 00:05:57 UTC


README

一个NEOS扩展包,它添加了一个新的页面文档类型。它允许你创建全局内容,并从Fusion的任何地方读取它。

安装

composer require arsors/globalcontent 添加到你的NEOS项目中。

设置单个全局内容页面

  • 在你的站点包配置文件夹中创建一个 NodeTypes.GlobalContent.yaml
  • 填充并调整 NodeTypes.GlobalContent.yaml
'Arsors.GlobalContent:GlobalContent':
  ui:
    inspector:
      groups:
        default:
          label: 'General'
          collapsed: true
          icon: 'globe' # Use fontawesome icon titles (without icon- prefix)
        anotherGroup:
          label: 'Another Group'
          collapsed: false
  properties:
    set-a-key:
      type: string
      defaultValue: 'Default Value'
      ui:
        group: 'default' # You can leave out the group (Standard group is 'default')
        inlineEditable: TRUE  
  • 在你的网站上添加一个 Global Content 页面。

设置多个全局内容页面

对于多个全局内容页面,你必须添加和调整你的包的 Settings.yaml。你还必须添加你的全局内容yaml配置,并将你的节点类型设置为Fusion中的Arsors.GlobalContent:Abstract原型。

按照以下步骤实现多个全局内容页面

  • 添加并调整到你的 Settings.yaml
Arsors:
  GlobalContent:
    instanceof:
      - 'Arsors.GlobalContent:GlobalContent'
      - 'Vendor.Packagename:AnotherGlobalContent'
  • 在你的站点包配置文件夹中创建一个 NodeTypes.GlobalContent.yaml
  • 填充并调整 NodeTypes.GlobalContent.yaml
'Arsors.GlobalContent:GlobalContent':
  ui:
    inspector:
      groups:
        default:
          label: 'General'
          collapsed: true
          icon: 'globe' # Use fontawesome icon titles (without icon- prefix)
        anotherGroup:
          label: 'Another Group'
          collapsed: false
  properties:
    set-a-key:
      type: string
      defaultValue: 'Default Value'
      ui:
        group: 'default' # You can leave out the group (Standard group is 'default')
        inlineEditable: TRUE

'Vendor.Packagename:AnotherGlobalContent':
  superTypes:
    'Arsors.GlobalContent:Abstract': true
  ui:
    label: 'Form Translation'
    icon: 'file'
  properties:
    set-another-key:
      type: string
      defaultValue: 'Your default value'
      ui:
        inlineEditable: TRUE
  • 添加到你的Fusion文件中
prototype(Vendor.Packagename:AnotherGlobalContent) < prototype(Arsors.GlobalContent:Abstract)
  • 将你的全局内容页面添加到你的网站上。

提示 如果你想要禁用标准全局内容节点类型,请参考以下内容。

读取全局属性

  • 通过Fusion获取内容
varName = Arsors.GlobalContent:GetGlobalContent {
    key = 'your-feld-key'
}

禁用标准全局内容节点类型

  • 在一个NodeTypes yaml文件中添加 'Arsors.GlobalContent:GlobalContent': ~