【发布时间】:2022-01-12 17:01:06
【问题描述】:
我已经扩展和调整了ext:form 的flexform,就像here 描述的那样:
ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']
['SC_OPTIONS']
[\TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools::class]
['flexParsing']
[] = \Vendor\ExtKey\Hooks\FlexFormHook::class;
类/Hooks/FlexFormHook.php:
<?php
namespace Vendor\ExtKey\Hooks;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class FlexFormHook
{
/**
* @param array $dataStructure
* @param array $identifier
* @return array
*/
public function parseDataStructureByIdentifierPostProcess(array $dataStructure, array $identifier): array
{
if ($identifier['type'] === 'tca' && $identifier['tableName'] === 'tt_content' && $identifier['dataStructureKey'] === '*,form_formframework') {
$file = Environment::getPublicPath() . '/typo3conf/ext/extKey/Configuration/Example.xml';
$content = file_get_contents($file);
if ($content) {
$dataStructure['sheets']['extraEntry'] = GeneralUtility::xml2array($content);
}
}
return $dataStructure;
}
}
弹性形式:
<extra>
<ROOT>
<TCEforms>
<sheetTitle>Fo</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.postsPerPage>
<TCEforms>
<label>Max. number of posts to display per page</label>
<config>
<type>input</type>
<size>2</size>
<eval>int</eval>
<default>3</default>
</config>
</TCEforms>
</settings.postsPerPage>
</el>
</ROOT>
</extra>
现在我可以为表单设置自定义设置,并且到目前为止,不需要将表单的 YAML 配置加倍。
但是:
我无法在模板中使用{settings.postsPerPage} 访问设置,也无法在自定义修整器中获取它们。
是否有可能在ext:form 的模板和我的自定义修整器中获取我的自定义设置?如果有,怎么做?
【问题讨论】:
标签: typo3 typo3-10.x