itplusx / headless-container
EXT:headless 的容器内容元素(EXT:container)json 输出
v2.0.0
2024-01-03 15:45 UTC
Requires
- php: ^8.1
- b13/container: ^2.0
- friendsoftypo3/headless: ^4.0
- typo3/cms-core: ^12.4
Replaces
- typo3-ter/headless-container: v2.0.0
This package is auto-updated.
Last update: 2024-08-31 00:42:44 UTC
README
这个 TYPO3 扩展使得能够使用 EXT:container 和 EXT:headless。
安装
使用 composer 安装(推荐)
$ composer require itplusx/headless-container
使用 TYPO3 扩展管理器安装
查看: 扩展管理
需求和兼容性
用法
- 包含 TypoScript (如 TypoScript 参考所述)
- 注册自定义容器元素 (如 EXT:container 所述)
- 定义 TypoScript ...
(假设你使用的是b13-2cols-with-header-container)- ... 对于简单容器元素
tt_content.b13-2cols-with-header-container =< lib.container - ... 对于具有头部 TCA 字段的容器元素
tt_content.b13-2cols-with-header-container =< lib.containerWithHeader - ... 对于具有自定义 TCA 字段的容器元素
(有关更多信息,请参阅 EXT:headless 文档)tt_content.b13-2cols-with-header-container =< lib.container tt_content.b13-2cols-with-header-container.fields.content.fields { myCustomField = TEXT myCustomField.field = myCustomTcaField }
- ... 对于简单容器元素
- 就这么多!你现在应该能看到自定义容器元素的 JSON 输出了!
示例 JSON 输出
{
"id": 2,
"type": "b13-2cols-with-header-container",
"colPos": 0,
"categories": "",
"appearance": {
"layout": "default",
"frameClass": "default",
"spaceBefore": "",
"spaceAfter": ""
},
"content": {
"header": "Container Header",
"subheader": "Container Subheader",
"headerLayout": 0,
"headerPosition": "",
"headerLink": "",
"myCustomField": "myCustomValue",
"items": [
{
"config": {
"name": "header",
"colPos": 200
},
"contentElements": [
{
"id": 3,
"type": "text",
"colPos": 200,
"categories": "",
"appearance": {...},
"content": {...}
}
]
},
{
"config": {
"name": "left side",
"colPos": 201
},
"contentElements": [
{
"id": 4,
"type": "text",
"colPos": 201,
"categories": "",
"appearance": {...},
"content": {...}
},
{
"id": 9,
"type": "text",
"colPos": 201,
"categories": "",
"appearance": {...},
"content": {...}
}
]
},
{
"config": {
"name": "right side",
"colPos": 202
},
"contentElements": [
{
"id": 5,
"type": "text",
"colPos": 202,
"categories": "",
"appearance": {...},
"content": {...}
}
]
}
]
}
}
贡献
欢迎对这个项目的任何帮助!无论是代码贡献还是改进的建议。但我们希望您遵循以下规则
- 问题
在添加问题时,请尽可能详细地描述错误/功能/任务。只提供标题是不够的。请使用问题模板。 - 提交
我们的团队遵循 Conventional Commits。我们希望您在想要贡献时坚持这些规则。 - 拉取请求
在提交 PR 之前,请先创建一个问题,并将其链接到拉取请求或至少添加一个 PR 描述,其中包含有关此 PR 的详细信息。否则,我们无法决定此 PR 是否值得合并到主分支。