Issue Feature Closed

#52579Add an hook to modify the header of a page in the "web_layout" module

Eric Chavaillaz 10/07/13, 14:15 updated 10/23/17, 21:45

Description

Hi all,

In the “PageLayoutController”, there is a hook to alter the footer rendering of the “web_layout” module.
It will be great to add the same to alter the header of it.

I propose :

Before :

// Add the content for each table we have rendered (traversing $tableOutput variable)
foreach ($tableOutput as $table => $output) {
    $content .= $this->doc->section('', $output, TRUE, TRUE, 0, TRUE);
    $content .= $this->doc->spacer(15);
    $content .= $this->doc->sectionEnd();
}
// Making search form:
if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) {
    $sectionTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.search', TRUE));
    $content .= $this->doc->section($sectionTitle, $dblist->getSearchBox(0), FALSE, TRUE, FALSE, TRUE);
}
// Additional footer content
$footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawFooterHook'];
if (is_array($footerContentHook)) {
    foreach ($footerContentHook as $hook) {
        $params = array();
        $content .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);
    }
}

After :

// Init the content
$content = '';
// Additional header content
$headerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'];
if (is_array($headerContentHook)) {
    foreach ($headerContentHook as $hook) {
        $params = array();
        $content .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);
    }
}
// Add the content for each table we have rendered (traversing $tableOutput variable)
foreach ($tableOutput as $table => $output) {
    $content .= $this->doc->section('', $output, TRUE, TRUE, 0, TRUE);
    $content .= $this->doc->spacer(15);
    $content .= $this->doc->sectionEnd();
}
// Making search form:
if (!$this->modTSconfig['properties']['disableSearchBox'] && count($tableOutput)) {
    $sectionTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.search', TRUE));
    $content .= $this->doc->section($sectionTitle, $dblist->getSearchBox(0), FALSE, TRUE, FALSE, TRUE);
}
// Additional footer content
$footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawFooterHook'];
if (is_array($footerContentHook)) {
    foreach ($footerContentHook as $hook) {
        $params = array();
        $content .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);
    }
}

I will make a patch this evening.

Thanks,
Eric

Reviews 1