TYPO3:如何在后端配置插件预览
在后端,我想显示编辑器选择的插件的一些配置。就像在powermail或新闻插件中一样。如何实现这一点?您可以应用与以下相同的逻辑:TYPO3:如何在后端配置插件预览,typo3,backend,extbase,Typo3,Backend,Extbase,在后端,我想显示编辑器选择的插件的一些配置。就像在powermail或新闻插件中一样。如何实现这一点?您可以应用与以下相同的逻辑: 你可以: 或者,您可以实现tt\u content\u drawItemhook: $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content\u drawItem']['fluid_styled_slider']=\Acme\Packag
- 你可以:
- 或者,您可以实现
hook:tt\u content\u drawItem
然后实现这个钩子:$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content\u drawItem']['fluid_styled_slider']=\Acme\Package\MyPreviewRenderer::class;
namespace Acme\Package; 使用TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface; 类MyPreviewRender实现PageLayoutViewDrawItemHookInterface { /** * ... */ 公共函数预处理(PageLayoutView&$parentObject、&$drawItem、&$headerContent、&$itemContent、数组和$row) { //1.在“列表”的情况下,为您的内容元素选中$row['CType'],为您的插件选中$row['list\U type'] //2.用预览填充$itemContent //3.设置$drawItem=false;以防止呈现默认预览 } }
- 你可以:
- 或者,您可以实现
hook:tt\u content\u drawItem
然后实现这个钩子:$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content\u drawItem']['fluid_styled_slider']=\Acme\Package\MyPreviewRenderer::class;
namespace Acme\Package; 使用TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface; 类MyPreviewRender实现PageLayoutViewDrawItemHookInterface { /** * ... */ 公共函数预处理(PageLayoutView&$parentObject、&$drawItem、&$headerContent、&$itemContent、数组和$row) { //1.在“列表”的情况下,为您的内容元素选中$row['CType'],为您的插件选中$row['list\U type'] //2.用预览填充$itemContent //3.设置$drawItem=false;以防止呈现默认预览 } }
mod.web\u layout.tt\u content.preview.list=1
,否则任何流体预览都无法工作。由于核心检查,您必须检查数组是否存在。如果没有此设置,则仅设置了['list.]
。我无法确认这些选项是否有效。我认为上面提到的配置期望CType是相关的修饰符。但是对于插件来说,它是列表类型,CType总是“列表”。没错,我已经添加了更多关于这方面的细节。所以对于选项a,即修改页面,似乎没有选择?另一个很好的建议,我也添加了一个例子。此外,我还链接了TYPO3v9中的相关源代码。至少对于Typo3V10,您还必须设置mod.web\u layout.tt\u content.preview.list=1
,否则任何流体预览都无法工作。由于核心检查,您必须检查数组是否存在。如果没有此设置,则仅设置['list.]
。
// Register preview for a custom content element
mod.web_layout.tt_content.preview.my_content_element = EXT:my_ext/Resources/Private/Templates/Preview/MyContentElement.html
// Register preview for a plugin
mod.web_layout.tt_content.preview.list.myext_myplugin = EXT:my_ext/Resources/Private/Templates/Preview/MyPlugin.html