b13 / listelements
将列表元素添加到 tt_content
1.3.1
2024-08-15 08:14 UTC
Requires
- php: ^7.4 || ~8.0
- typo3/cms-backend: ^11.5 || ^12.4 || ^13.1
- typo3/cms-fluid-styled-content: ^11.5 || ^12.4 || ^13.1
Requires (Dev)
- b13/listelements-example: *
- saschaegerer/phpstan-typo3: ^1.8
- typo3/cms-frontend: ^11.5 || ^12.4 || ^13.1
- typo3/cms-workspaces: ^11.5 || ^12.4 || ^13.1
- typo3/coding-standards: ^0.5.5
- typo3/testing-framework: ^7.0 || ^8.0
- dev-master
- 1.3.1
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.2
- 1.0.1
- 1.0.0
- 0.3.1
- 0.3.0
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0.x-dev
- 0.2.0
- 0.1.8
- 0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-sqlPerformance
- dev-task/dataprocessor
- dev-bmack-patch-1
- dev-bugfix/php8-fallback
- dev-remove-custom-fileservice
- dev-workspace-backend-previews
- dev-BEXT-324
- dev-bugfix/deps
- dev-BEXT-251
This package is auto-updated.
Last update: 2024-09-15 08:31:04 UTC
README
关于此扩展
此扩展向 tt_content 添加列表项。它向 tt_content
添加一个数据库字段 tx_listelements_list
,允许将灵活的列表项作为 IRRE 记录添加到任何内容元素。
安装
通过安装并添加 TypoScript 设置到您的站点-扩展设置中,将扩展添加到您的项目中
@import 'EXT:listelements/Configuration/TypoScript/setup.typoscript'
这将为您的内容元素的 Fluid 模板变量添加添加列表项的配置,如下所示
<f:for each="{listitems}" as="item">
...
</f:for>
后端页面布局视图预览
此扩展添加了一个钩子和一个 Service 类,允许使用 Fluid 模板自定义后端页面布局视图的显示。如果您为后端预览添加了额外的资产/图像字段,请使用此功能添加自定义预览数据。
EXT:site_extension/Classes/Hooks/DrawItem.php
:
<?php
namespace B13\SiteExtension\Hooks;
use TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface;
use TYPO3\CMS\Backend\View\PageLayoutView;
/**
* Class/Function to manipulate the rendering of item preview content
*
*/
class DrawItem implements PageLayoutViewDrawItemHookInterface
{
/**
* @param PageLayoutView $parentObject : The parent object that triggered this hook
* @param boolean $drawItem : A switch to tell the parent object, if the item still must be drawn
* @param string $headerContent : The content of the item header
* @param string $itemContent : The content of the item itself
* @param array $row : The current data row for this item
*
* @return void
*/
public function preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row)
{
// get all list items (database column 'test_list') including all assets
if ($row['test_list']) {
// array &$row, $field = '', $table = 'tt_content', $filereferences = 'assets, additional_assets'
\B13\Listelements\Service\ListService::resolveListitems($row, 'test_list', 'tt_content');
}
}
}
关于配置的重要信息
请记住,为了在所有列表项中保存语言 uid 等隐藏字段,请将 hiddenpalette
添加到您自己内容元素的 showitems
配置中。