2

我有一个 FE 插件,它使用 FlexFormMyExtFlexForm来设置某些配置,例如limit or SourcePage etc..

在我的控制器操作中list,我使用$this->settings. 工作到现在都很好。

现在,我发出 AJAX 行动号召update,我需要使用之前通过 FlexForm 为该页面上的 FE 插件设置的相同设置。$this->settings does not show anything.

我检查了一下$GLOBALS['TSFE']->tmpl->setup['plugin']['MyExt.']['settings.'],FlexForm 中定义的设置都没有显示在这里。

我该如何解决这个问题?

编辑:

我的示例 Flexform 如下所示:

<sheets>
        <sDEF>
            <ROOT>
                <TCEforms>
                    <sheetTitle>View Settings</sheetTitle>
                </TCEforms>
                <type>array</type>
                <el>
                    <switchableControllerActions>
                        <TCEforms>
                            <label>Select</label>
                            <config>
                                <type>select</type>
                                <items>
                                    <numIndex index="0">
                                        <numIndex index="0">MyFunction</numIndex>
                                        <numIndex index="1">MyExt->list</numIndex>
                                    </numIndex>
                                </items>
                            </config>
                        </TCEforms>
                    </switchableControllerActions>

                    <settings.flexform.limit>
                        <TCEforms>
                            <label>Number of items to be displayed</label>
                            <config>
                                <type>input</type>
                                <size>10</size>
                            </config>
                        </TCEforms>
                    </settings.flexform.limit>
                </el>
            </ROOT>
        </sDEF>
    </sheets>

然后我对我的控制器操作进行 AJAX 调用并打印它$this->settings,不显示任何设置。

4

2 回答 2

2

最简单的解决方案是在 FlexForm 中正确命名字段,即,如果您的字段带有前缀,settings.它将在$this->settings数组中可见:

<settings.myField>
    <TCEforms>
        <label>My very special setting</label>
        <config>
            <type>input</type>
        </config>
    </TCEforms>
</settings.myField>

控制器:

$mySetting = $this->settings['myField'];

另一方面,如果您打算将 TS 设置与 FlexForm 设置合并,您可以在其前面加上一些其他词,例如:<settings.flexform.myField>然后访问它:

$fromTypoScript = $this->settings['myField'];
$fromFlexform   = $this->settings['flexform']['myField'];

// or...
$myMergedSetting = (!$this->settings['flexform']['myField'])
                   ? $this->settings['myField']
                   : $this->settings['flexform']['myField'];
于 2013-10-31T10:01:02.160 回答
2

我刚刚遇到了一个解决方案:https ://forum.typo3.org/index.php/t/194022/eigener-extbase-controller-keine-flexform-werte

我包括这样的插件:

AJAX_PAGE = PAGE
AJAX_PAGE {
    typeNum = 2

    10 < tt_content.list.20.myPlugin

    config {
        disableAllHeaderCode = 1
        xhtml_cleaning = 0
        admPanel = 0
        debug = 0
        no_cache = 1
    }
}

为了正确加载设置,它应该是:

AJAX_PAGE = PAGE
AJAX_PAGE {
    typeNum = 2

    10 < styles.content.get
    10 {
        select.where = colpos = 0
        select.andWhere = list_type='myPlugin'
    }

    config {
        disableAllHeaderCode = 1
        xhtml_cleaning = 0
        admPanel = 0
        debug = 0
        no_cache = 1
    }
}
于 2015-11-13T11:30:18.587 回答