尝试保存页面时出现此错误,我已向页面添加了一个新选项卡,当我尝试保存时显示此错误:
1: Attempt to insert record on page 'Page name' (371) where this table, tx_myext_domain_model_name, is not allowed
我已经尝试将模型表添加到允许的页面,将此行添加到 ext_localconf.php:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_myext_domain_model_name');
我还检查 ts_config mod.web_list.allowedNewTables / DeniedNewTables 中是否有任何允许或拒绝的内容
项目 TYPO3 版本 11
您还有其他想法可以尝试吗? 谢谢
方法文档块看起来像
/**
* Add tablename to default list of allowed tables on pages (in $PAGES_TYPES)
* Will add the $table to the list of tables allowed by default on pages as setup by $PAGES_TYPES['default']['allowedTables']
* FOR USE IN ext_tables.php FILES
*
* @param string $table Table name
*/
public static function allowTableOnStandardPages($table) {}
将其移至您的扩展
ext_tables.php
文件而不是 ext_localconf.php
文件。
遗憾的是,您没有提供要添加记录的位置。如果是普通(标准页面)则需要调用上面的方法。将其添加到 sysfolders 应该可以开箱即用。
但是如果你想将其添加到根节点,你需要为你的表设置TCA ctrl选项rootLevel [1],可以在
Configuration/TCA/tx_myext_domain_model_entity.php
或Configuration/TCA/Overrides/tx_myext_domain_model_entity.php
中。
// Configuration/TCA/tx_myext_domain_model_entity.php
return [
'ctrl' => [
// ...
// 0 (false): Default. Can only exist in the page tree
// 1 (true) : Can only exist in the root
// -1 : Can exist in both page tree and root
'rootLevel' => -1,
// ...
],
// ...
];
或
// Configuration/TCA/Overrides/tx_myext_domain_model_entity.php
// 0 (false): Default. Can only exist in the page tree
// 1 (true) : Can only exist in the root
// -1 : Can exist in both page tree and root
$GLOBALS['TCA']['tx_myext_domain_model_entity']['ctrl']['rootLevel'] = 0;
[1] https://docs.typo3.org/m/typo3/reference-tca/main/en-us/Ctrl/Properties/RootLevel.html#rootlevel