【问题标题】:Show Typo3 FlexForm checkbox items inline内联显示 Typo3 FlexForm 复选框项目
【发布时间】:2015-05-18 19:55:49
【问题描述】:

是否可以内联显示复选框,以便在 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>                  

【问题讨论】:

  • 所以你的意思是如果你检查'ownchoice_for_sale',表格会重新加载并显示'ownchoice_reserved'? inline 代表“内联关系记录编辑(IRRE)”参见docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Inline/…
  • 不,我的意思是该选项在表单中内联显示。所以彼此背后而不是彼此之上。
  • 好的,我已经回答了你的问题。祝你好运! :)

标签: typo3


【解决方案1】:

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
}

【讨论】:

  • 很遗憾结果是一个字符串......所以我们不能很好地直接处理它......但是感谢这个解决方案!比制作​​ 3 个单独的复选框要好得多
猜你喜欢
  • 1970-01-01
  • 2017-06-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-31
  • 2013-02-28
  • 2020-08-06
  • 1970-01-01
相关资源
最近更新 更多