内联显示 Typo3 FlexForm 复选框项目
Show Typo3 FlexForm checkbox items inline
是否可以使用 FlexForm 以内联方式显示复选框,使它们在彼此后面显示?我现在使用以下代码,但它显示了垂直列表中的每个设置。
<settings.ownchoice_for_sale>
<TCEforms>
<label>For sale</label>
<config>
<type>check</type>
</config>
</TCEforms>
</settings.ownchoice_for_sale>
<settings.ownchoice_reserved>
<TCEforms>
<label>Reserved</label>
<config>
<type>check</type>
</config>
</TCEforms>
</settings.ownchoice_reserved>
Flexforms 不支持 TCA 提供的 palette
功能。
您可以使用 multiple value selector
在单个字段中提供所有可用选项,而不是使用 checkboxes
(参见:http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Select/Index.html#columns-select-examples-multiple)。
您的例子:
<settings.ownchoice>
<TCEforms>
<label>Own Choice</label>
<config>
<type>select</type>
<items>
<numIndex index="0">
<numIndex index="0">For Sale</numIndex>
<numIndex index="1">for_sale</numIndex>
</numIndex>
<numIndex index="1">
<numIndex index="0">Reserved</numIndex>
<numIndex index="1">for_sale</numIndex>
</numIndex>
</items>
<size>10</size>
<minitems>0</minitems>
<maxitems>100</maxitems>
<suppress_icons>1</suppress_icons>
</config>
</TCEforms>
</settings.ownchoice>
在你的控制器中:
$options = ($this->settings['ownchoice'] ? \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->settings['ownchoice']) : array());
if (in_array('for_sale', $options)) {
// option 'for_sale' is selected
}
是否可以使用 FlexForm 以内联方式显示复选框,使它们在彼此后面显示?我现在使用以下代码,但它显示了垂直列表中的每个设置。
<settings.ownchoice_for_sale>
<TCEforms>
<label>For sale</label>
<config>
<type>check</type>
</config>
</TCEforms>
</settings.ownchoice_for_sale>
<settings.ownchoice_reserved>
<TCEforms>
<label>Reserved</label>
<config>
<type>check</type>
</config>
</TCEforms>
</settings.ownchoice_reserved>
Flexforms 不支持 TCA 提供的 palette
功能。
您可以使用 multiple value selector
在单个字段中提供所有可用选项,而不是使用 checkboxes
(参见:http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Select/Index.html#columns-select-examples-multiple)。
您的例子:
<settings.ownchoice>
<TCEforms>
<label>Own Choice</label>
<config>
<type>select</type>
<items>
<numIndex index="0">
<numIndex index="0">For Sale</numIndex>
<numIndex index="1">for_sale</numIndex>
</numIndex>
<numIndex index="1">
<numIndex index="0">Reserved</numIndex>
<numIndex index="1">for_sale</numIndex>
</numIndex>
</items>
<size>10</size>
<minitems>0</minitems>
<maxitems>100</maxitems>
<suppress_icons>1</suppress_icons>
</config>
</TCEforms>
</settings.ownchoice>
在你的控制器中:
$options = ($this->settings['ownchoice'] ? \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->settings['ownchoice']) : array());
if (in_array('for_sale', $options)) {
// option 'for_sale' is selected
}