问题
In the backend I want to display some configurations of the plugin the editor has selected. Like in powermail or news plugin. How can this be achieved?
回答1:
You'd apply the same logic as for a custom preview of any custom element:
You can 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
Alternatively you can implement the
tt_content_drawItem
hook:$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['fluid_styled_slider'] = \Acme\Package\MyPreviewRenderer::class;
And then implement this hook:
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 } }
来源:https://stackoverflow.com/questions/55691663/typo3-how-to-configure-plugin-preview-in-backend