TYPO3:如何在后端配置插件预览
TYPO3: How to configure plugin preview in Backend
在后台我想显示编辑器选择的插件的一些配置。就像在 powermail 或新闻插件中一样。如何实现?
您将应用与 custom preview of any custom element:
相同的逻辑
你可以use PageTS to register a custom Fluid template:
// 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
或者您可以实现 tt_content_drawItem
挂钩:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['fluid_styled_slider'] = \Acme\Package\MyPreviewRenderer::class;
然后实现这个钩子:
namespace Acme\Package;
use TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface;
class MyPreviewRenderer implements PageLayoutViewDrawItemHookInterface
{
/**
* ...
*/
public function preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row)
{
// 1. Check $row['CType'] for your content element and $row['list_type'] for your plugin in case of "list"
// 2. Fill $itemContent with your preview
// 3. Set $drawItem = false; to prevent rendering of the default preview
}
}
在后台我想显示编辑器选择的插件的一些配置。就像在 powermail 或新闻插件中一样。如何实现?
您将应用与 custom preview of any custom element:
相同的逻辑你可以use PageTS to register a custom Fluid template:
// 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
或者您可以实现
tt_content_drawItem
挂钩:$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['fluid_styled_slider'] = \Acme\Package\MyPreviewRenderer::class;
然后实现这个钩子:
namespace Acme\Package; use TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface; class MyPreviewRenderer implements PageLayoutViewDrawItemHookInterface { /** * ... */ public function preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row) { // 1. Check $row['CType'] for your content element and $row['list_type'] for your plugin in case of "list" // 2. Fill $itemContent with your preview // 3. Set $drawItem = false; to prevent rendering of the default preview } }