TYPO3 Fluid动态键在参数中

问题描述 投票:0回答:2

我想用参数的动态键渲染部分。

在部分:

<f:link.action action="{action}" controller="{controller}" 
arguments="{'{argument1name}': argument1, '{argument2name}': argument2}">
{bla}
</f:link.action>

那么argument1名称和参数2名称可以在Fluid中动态编写吗?什么是语法,上面显然是错误的。更好的是具有未知数量的参数的数组。

typo3 fluid typo3-9.x
2个回答
0
投票

在流体中,数组的键永远不会包含在'中,你的语法显然是错误的。 如果值包含在'中,则为常量文本,否则将其解释为变量。因此,密钥以不同于值的方式处理。


0
投票

我找到了解决问题的方法。在流体模板..

<f:variable name="modalArguments" value="{organization: organization, contactperson: contactperson}"/>
<f:render partial="Components/ActionModal" arguments="{modalTitle: 'Bla', modalBody: 'Are you sure {contactperson.name} bla?', action: 'delete', controller: 'Contactperson', modalArguments: modalArguments}"/>

在部分类似的东西

<f:link.action action="{action}" controller="{controller}" arguments="{modalArguments}" class="btn btn-primary">bla</f:link.action>

因此可以将arguments数组放入变量中。

© www.soinside.com 2019 - 2024. All rights reserved.