[FEATURE] Preview of plugins in the backend 23/51223/4
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 9 Jan 2017 19:11:00 +0000 (20:11 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 2 Feb 2017 14:49:12 +0000 (15:49 +0100)
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 <no-reply@typo3.com>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/core/Documentation/Changelog/master/Feature-79225-PluginPreviewWithFluid.rst [new file with mode: 0644]

index c54c4ed..709875f 100644 (file)
@@ -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 (file)
index 0000000..467148b
--- /dev/null
@@ -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