typo3 page view: manipulate the look of a content element

One of my customers wanted to see in the page view, which section_frame option they chose. So I found out there is a hook to manipulate the title and text below the grey bar. Add the following to the ext_localconf.php:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['section_frame_name'] = 'Ophi\\OphiSomething\\Hook\\CustomPageLayoutView';

And in Ophi/OphiSomething/Classes/Hook there is the following hook file:

namespace Ophi\OphiSomething\Hook;

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

class CustomPageLayoutView implements PageLayoutViewDrawItemHookInterface {

     * Preprocesses the preview rendering of a content element.
     * @param PageLayoutView $parentObject Calling parent object
     * @param boolean $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) {
        $headerContent = str_replace("", " (Section Frame: " . ($row['section_frame']) . ")", $headerContent);

And the result looks like this:
Thanks for helping me find the answer quickly to this Stackoverflow entry and this helpful page

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.