在flexform配置中,我有一个选择字段“categoryTags”
<config>
<type>select</type>
<foreign_table>sys_category</foreign_table>
<minitems>0</minitems>
<maxitems>10</maxitems>
<multiple>1</multiple>
<dce_load_schema>1</dce_load_schema>
</config>
在fluid-template中我从中得到了followig数组:
array(3 items)
0 => array(29 items)
uid => '77' (2 chars)
title => 'Category1' (18 chars)
...
1 => array(29 items)
uid => '78' (2 chars)
title => 'Category2' (18 chars)
...
2 => array(29 items)
uid => '79' (2 chars)
title => 'Category3' (18 chars)
...
现在我想在li菜单中获取类别列表。但是应该显示所有类别标题(不仅是选中的 - 我将手动执行此操作),如果在flexform中选择了类别,则应更改或添加类。
结果应该是:
<ul class="list-inline">
<li class="selected">Category1</li>
<li class="">Category2</li>
<li class="">Category3</li>
</ul>
例如。这只显示选定的人(不是全部):
<f:for each="{field.categoryTags}" as="tags">
<li>{tags.title} <i class="fa fa-check-square-o" aria-hidden="true"></i></li>
</f:for>
这当然不会在循环中起作用:
<f:for each="{field.categoryTags}" as="tags">
<li class="{f:if(condition: '{tags.uid} == 77', then: 'selected')}">Category1</li>
<li class="{f:if(condition: '{tags.uid} == 78', then: 'selected')}">Category2</li>
<li class="{f:if(condition: '{tags.uid} == 79', then: 'selected')}">Category3</li>
</f:for>
是否存在流动的可能性?