[TYPO3-english] Preview of self defined CEs

Bernd Wilke t3n at pi-phi.de
Fri Dec 4 11:06:45 CET 2015


I'm still stuck realizing a BE-preview of my new defined CEs in 7.6.0
in ext_localconf.php I have:

$GLOBALS['TYPO3_CONF_VARS']
         ['SC_OPTIONS']
         ['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']
         ['my_textpic'] = 
\ME\MyConfig\Hooks\PageLayoutView\MyTextPicPreviewRenderer::class;

in 
EXT:my_config/Classes/Hooks/PageLayoutView/MyTextPicPreviewRenderer.php 
I have:
----------------------
<?php
namespace ME\MyConfig\Hooks\PageLayoutView;

use \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface;
use \TYPO3\CMS\Backend\View\PageLayoutView;

class MyTextPicPreviewRenderer implements 
\TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface
{

     /**
      * Preprocesses the preview rendering of a content element of type 
"my_textpic"
      *
      * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject 
Calling parent object
      * @param bool $drawItem Whether to draw the item using the default 
functionality
      * @param string $headerContent Header content
      * @param string $itemContent Item content
      * @param array $row Record row of tt_content
      *
      * @return void
      */
     public function preProcess(
         \TYPO3\CMS\Backend\View\PageLayoutView &$parentObject,
         &$drawItem,
         &$headerContent,
         &$itemContent,
         array &$row
     )
     {
         if ($row['CType'] === 'my_textpic') {
           :
         }
     }
}
?>
------------------

but all I get in the BE is:
#1218547409: $hookObject must implement interface 
TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface


I found multiple examples how to build (and preview) own CEs but all 
work in differnt kinds and with different syntax (which evolves from 4.3 
to 7.6)

- - - - -

The other way for own previews I found was in page.TSconfig:

mod.web_layout.tt_content.preview {
     my_textpic = 
EXT:my_config/Resources/Private/Templates/Preview/TextPic.html
}
but that did not work either for my own CEs (just for CEs from FSC)

the default preview includes headline and text, but also I use the field 
'assets' for images/videos (like in the text&media CEs from FSC) there 
is no preview of the images, which is very inconvenient for editors.
previously I used the field 'image' (like in the old textpic CE from 
CSC) and there was a preview of the images by default.


anyone who can help to analyze the errors or give me a hand for a 
working full preview?


bernd


More information about the TYPO3-english mailing list