TYPO3 backend: hide content element preview title header header_layout

raw

Classes/Typo3/HideContentHeader.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Example\Together\Typo3;
 
use TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface;
 
/**
 * Modify the content preview rendering in the backend.
 * Remove the content element header and header_layout rendering.
 *
 * @author Christian Weiske <weiske@mogic.com>
 */
class HideContentHeader implements PageLayoutViewDrawItemHookInterface
{
    /**
     * Remove "header" and "header_layout" in the backend content preview.
     *
     * @param object $parentObject  Calling parent object
     * @param bool   $drawItem      Whether to draw the item using the
     *                              default functionalities
     * @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'] == 'fluidcontent_content') {
            $headerContent = '';
        }
    }
}
?>
 
raw

ext_localconf.php

1
2
3
4
5
<?php
#hide content header in backend preview
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['together']
    = 'Example\\Together\\Typo3\\HideContentHeader';
 
Christian Weiske Christian Weiske
owner

History