<?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 = '';
        }
    }
}
?>
