kleisli/fusionfiles

此包最新版本(1.0.0)没有可用的许可证信息。

使用 Neos.Fusion 服务器不同的文件格式

安装: 0

依赖项: 1

建议者: 0

安全: 0

星标: 1

关注者: 1

分支: 0

开放问题: 0

类型:neos-package

1.0.0 2023-04-26 13:08 UTC

This package is auto-updated.

Last update: 2024-09-27 01:26:02 UTC


README

使用 Neos.Fusion 服务器不同的文件格式

可用格式

  • json
  • ics
  • pdf(需要额外的包 Kleisli.FusionFiles.Pdf)

Json

要将节点 My.NodeType 渲染为 json,只需添加一个扩展 Kleisli.FusionFiles:File.Json 的 fusion 原型 My.NodeType.Json,并将 json 值添加到数据属性中。

Eel 辅助工具

此包有其自己的 eel 辅助工具 FusionFiles.Json 以进行 jsonify,因为核心 eel 辅助工具无法正确替换 Neos 缓存标记。

示例

prototype(My.App:Document.List.Json) < prototype(Kleisli.FusionFiles:File.Json) {
    data {
        value = 'ok'
        getValueFromPrototype = My.App:Component.ListAsArray
    }
}

在请求 https://your.domain/path/to/node.json 时,响应将类似于

{
    "value" : "ok",
    "getValueFromPrototype" : [
        {"id": "abc"},
        {"id": "def"}
    ]
}

Ics 事件

使表示事件的节点可添加到日历中。

要将节点 My.Event 渲染为 ics,只需添加一个扩展 Kleisli.FusionFiles:File.Ics.Event 的 fusion 原型 My.Event.Ics,并将事件属性添加到数据属性中。

示例

prototype(My.App:Document.Event.Ics) < prototype(Kleisli.FusionFiles:File.Ics.Event) {
    data {
        startDateTime = ${node.properties.startDate}
        endDateTime = ${node.properties.endDate}
        title = ${node.properties.title}
    }
}

My.Event 的模板中,您可以像这样链接 ICS 文件

<Neos.Neos:NodeLink node={documentNode} attributes.href.format="ics">
    Add to calendar
</Neos.Neos:NodeLink>

使用其他文件格式的辅助工具

在您的包中添加一个 Request.fusion 文件,包含

root {
    // Hook into the root matcher to change rendering for fancy requests
    fancy = Kleisli.FusionFiles:Helper.RenderFileMatcher {
        fileExtension = 'fancy'
    }
}

以访问原型

prototype(My.App:Document.List.Fancy) < prototype(Neos.Fusion:Component) {
    renderer = ''
}

通过 https://your.domain/path/to/node.fancy

此包的开发得到了 Profolio - 一个职业选择和职业咨询的数字平台 - 的显著资助。