b13/listelements

将列表元素添加到 tt_content

安装次数: 27,608

依赖项: 0

建议者: 1

安全性: 0

星标: 8

关注者: 9

分支: 2

开放问题: 1

类型:typo3-cms-extension

1.3.1 2024-08-15 08:14 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 配置中。