TYPO3 v7.6 - 如何在后端呈现tt_content(页面模块)

时间:2016-02-19 19:12:13

标签: typo3 typo3-7.6.x

我正在开发一个TYPO3 v7.6项目,并创建了一个包含类型字段的flexform的内容元素,允许其他 tt_content 。这是该字段的配置:

<config type="array">
    <type>group</type>
    <internal_type>db</internal_type>
    <allowed>tt_content</allowed>
    <size>5</size>
    <maxitems>200</maxitems>
    <minitems>0</minitems>
    <multiple>1</multiple>
    <show_thumbs>1</show_thumbs>
</config>

flexform工作正常,我可以在编辑时添加内容。但是,我需要的是允许用户将同一页面上的内容移动(拖放)到该字段内部,就像在以前的版本中使用TemplaVoila时那样。

我为 tt_content_drawItem 创建了一个钩子,它实现了接口 PageLayoutViewDrawItemHookInterface ,我能够为我的插件更改 preProcess 函数,但我不知道如何创建一个带有“创建新内容元素”的dropzone区域,该区域允许将tt_content移入其中。

看起来处理此问题的原始TYPO3的 DragDrop.js 文件无法移动到内容元素中,而只能移动到页面中。这是对的吗?

是否有实现此功能或任何允许此功能的扩展?

修改

经过几天的研究和尝试扩展后,我找到了一个适合我需求的解决方案。我正在使用扩展 fluidcontent 来创建具有以下流体模板的内容元素:

{namespace flux=FluidTYPO3\Flux\ViewHelpers}
<f:layout name="Default" />

<f:section name="Configuration">    
        <flux:grid>
                <flux:grid.row >
                    <flux:grid.column name="content" label="Content"/>
                </flux:grid.row>
            </flux:grid>
    </flux:form>
</f:section>

<f:section name="Preview">  
</f:section>

<f:section name="Main">
        <flux:content.render area="content" /> 
</f:section>

但是,对于包含内容区域的flexform字段,我仍然无法拖放甚至可视化后端内容。

2 个答案:

答案 0 :(得分:0)

扩展Gridelements允许您在其他内容元素中创建内容元素(很像TemplaVoilà)。如果它允许你将内容元素拖到其他内容中,我还没有尝试过,但如果它也涵盖了内容,我也不会感到惊讶。

答案 1 :(得分:0)

您现在需要做的就是将<flux:widget.grid />放入预览部分。

这是我的2列内容元素的代码(在后端可见,包括拖放):

{namespace flux=FluidTYPO3\Flux\ViewHelpers}

    <f:layout name="Content" />

    <f:section name="Configuration">
        <flux:form id="2column" label="2 Columns" options="{icon: 'Icons/Content/Example.gif', group: 'MyGroup'}">
        </flux:form>
        <flux:grid>
            <flux:grid.row>
                <flux:grid.column colPos="0" label="Column 1" style="width: 50%" name="column1" />
                <flux:grid.column colPos="1" label="Column 2" style="width: 50%" name="column2" />
            </flux:grid.row>
        </flux:grid>
    </f:section>

    <f:section name="Preview">
        <flux:widget.grid />
    </f:section>

    <f:section name="Main">
        <div class="twocolumn1">
            <flux:content.render area="column1" />
        </div>
        <div class="twocolumn2">
            <flux:content.render area="column2" />  
        </div>
        <div class="clear"></div>
    </f:section>