typo3fluid-styled-content

How can i assign a preview template for the default Text/Media content element in TYPO3 backend?


I´d like to change the preview of the content element Text/Media in the backend. I tried to place a template in my extension and added the following page TS:

mod.web_layout {
tt_content {
preview {
  # My CType
  textmedia =  EXT:my_extension/Resources/Private/Templates/Preview/TextMedia.html
  }
 }
}

However no changes happen in the backend. How can i achieve overwriting the existing previews for a default fluid content elements?


Solution

  • The problem is that this only works for content-elements, that uses the StandardContentPreviewRenderer. But for the textmedia content-element the TextmediaPreviewRenderer is set in the TCA of the tt_content table.

    You have to unset this configuration, to use a custom template to render the textmedia content-element. For that implement the following file in your extension:
    my_extension/Configuration/TCA/Overrides/tt_content.php

    <?php
    defined('TYPO3') or die();
    
    unset($GLOBALS['TCA']['tt_content']['types']['textmedia']['previewRenderer']);
    

    Now you should be able to override the preview template.