TYPO3:覆盖字段正文以在扩展中加载 rte_ckeditor
TYPO3: Override field bodytext to load rte_ckeditor in extension
我目前正在将 TYPO3(和安装的自定义扩展)从 6.2 更新到 8.7。扩展创建了一些自定义内容元素,使用 "extbuilder" 构建。到目前为止一切都很好,但是 rte_ckeditor 未在这些内容元素的后端加载。 rte_ckeditor 已安装并在标准内容元素中工作。
我在此处 https://docs.typo3.org/m/typo3/reference-tca/8.7/en-us/ColumnsConfig/Type/Text.html 使用 columnsOverrides 在简单的第二个示例 "rte_1" 中进行了尝试。这是我在文件 typo3conf/ext/myExt/Configuration/TCA/Overrides/tt_content.php
中的代码
$GLOBALS['TCA']['tt_content']['types']['myext']['columnsOverrides'] = array(
'bodytext' => array(
'config' => array(
'type' => 'text',
'enableRichtext' => true,
)
)
);
在我的 ext_tables.php 字段中加载了:
$TCA['tt_content']['types']['myext_callout']['showitem'] = 'CType, header;Überschrift, subheader;Untertitel, image, bodytext;Beschreibung Preis/Leistung';
您知道为什么没有加载编辑器吗?
问题已解决。这是 tt_content.php 中的正确代码:
$customFields = [
'bodytext' => [
'exclude' => false,
'l10n_mode' => 'prefixLangTitle',
'label' => 'Inhalt',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 6,
'enableRichtext' => true
],
]
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content',$customFields);
我目前正在将 TYPO3(和安装的自定义扩展)从 6.2 更新到 8.7。扩展创建了一些自定义内容元素,使用 "extbuilder" 构建。到目前为止一切都很好,但是 rte_ckeditor 未在这些内容元素的后端加载。 rte_ckeditor 已安装并在标准内容元素中工作。
我在此处 https://docs.typo3.org/m/typo3/reference-tca/8.7/en-us/ColumnsConfig/Type/Text.html 使用 columnsOverrides 在简单的第二个示例 "rte_1" 中进行了尝试。这是我在文件 typo3conf/ext/myExt/Configuration/TCA/Overrides/tt_content.php
中的代码 $GLOBALS['TCA']['tt_content']['types']['myext']['columnsOverrides'] = array(
'bodytext' => array(
'config' => array(
'type' => 'text',
'enableRichtext' => true,
)
)
);
在我的 ext_tables.php 字段中加载了:
$TCA['tt_content']['types']['myext_callout']['showitem'] = 'CType, header;Überschrift, subheader;Untertitel, image, bodytext;Beschreibung Preis/Leistung';
您知道为什么没有加载编辑器吗?
问题已解决。这是 tt_content.php 中的正确代码:
$customFields = [
'bodytext' => [
'exclude' => false,
'l10n_mode' => 'prefixLangTitle',
'label' => 'Inhalt',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 6,
'enableRichtext' => true
],
]
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content',$customFields);