From f66e421a18a740f198862cd34a310d55959c0dc7 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Mon, 9 Jan 2017 20:11:00 +0100 Subject: [PATCH] [FEATURE] Preview of plugins in the backend It is now possible to render the preview of plugins just like of regular content elements. Resolves: #79225 Releases: master Change-Id: Iab3fb50789135d5662ca3952a2de727b69090ce6 Reviewed-on: https://review.typo3.org/51223 Tested-by: TYPO3com Reviewed-by: Josef Glatz Reviewed-by: Susanne Moog Tested-by: Susanne Moog Reviewed-by: Markus Klein Tested-by: Markus Klein --- .../backend/Classes/View/PageLayoutView.php | 12 +++++++- .../Feature-79225-PluginPreviewWithFluid.rst | 28 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-79225-PluginPreviewWithFluid.rst diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php index c54c4ed7dfe2..709875fdd993 100644 --- a/typo3/sysext/backend/Classes/View/PageLayoutView.php +++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php @@ -1686,8 +1686,18 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe // mod.web_layout.tt_content.preview.media = EXT:site_mysite/Resources/Private/Templates/Preview/Media.html if ($drawItem) { $tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod.web_layout.tt_content.preview'); - if (!empty($tsConfig['properties'][$row['CType']])) { + $fluidTemplateFile = ''; + + if ( + $row['CType'] === 'list' && !empty($row['list_type']) + && !empty($tsConfig['properties']['list.'][$row['list_type']]) + ) { + $fluidTemplateFile = $tsConfig['properties']['list.'][$row['list_type']]; + } elseif (!empty($tsConfig['properties'][$row['CType']])) { $fluidTemplateFile = $tsConfig['properties'][$row['CType']]; + } + + if ($fluidTemplateFile) { $fluidTemplateFile = GeneralUtility::getFileAbsFileName($fluidTemplateFile); if ($fluidTemplateFile) { try { diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-79225-PluginPreviewWithFluid.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-79225-PluginPreviewWithFluid.rst new file mode 100644 index 000000000000..467148b823d0 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-79225-PluginPreviewWithFluid.rst @@ -0,0 +1,28 @@ +.. include:: ../../Includes.txt + +=========================================== +Feature: #79225 - Plugin preview with Fluid +=========================================== + +See :issue:`79225` + +Description +=========== + +The page TSconfig to render a preview of a single content element in the Backend has been improved +by allowing the rendering of plugins now as well. + +The following option allows to override the default output of a plugin via page TSconfig: + +.. code-block:: typoscript + + mod.web_layout.tt_content.preview.list.example = EXT:site_mysite/Resources/Private/Templates/Preview/ExamplePlugin.html + +All properties of the tt_content record are available in the template directly. +Any data of the flexform field `pi_flexform` is available with the property `pi_flexform_transformed` as an array. + +.. note:: + + If a PHP hook already is set to render the element, it will take precedence over the Fluid-based preview. + +.. index:: Backend, Fluid \ No newline at end of file -- 2.20.1