Skip to content

Instantly share code, notes, and snippets.

@kitzberger
Created June 27, 2023 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitzberger/e5954e5d349b90123fdf2ce97b78e7d9 to your computer and use it in GitHub Desktop.
Save kitzberger/e5954e5d349b90123fdf2ce97b78e7d9 to your computer and use it in GitHub Desktop.
TYPO3 PageModule Enhancements
<?php
defined('TYPO3') || die('Access denied.');
// Hook into page module
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'][] = \My\Extension\Hooks\PageModuleHook::class . '->info';
<?php
namespace My\Extension\Hooks;
use TYPO3\CMS\Backend\Controller\PageLayoutController;
use TYPO3\CMS\Backend\View\BackendLayoutView;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class PageModuleHook
{
public function info(array $params, PageLayoutController $controller)
{
$beLayout = GeneralUtility::makeInstance(BackendLayoutView::class)->getBackendLayoutForPage($controller->id);
$beLayoutTitle = $beLayout->getTitle();
$beLayoutTitle = $GLOBALS['LANG']->sL($beLayoutTitle) ?? $beLayoutTitle;
return '<h3>BE-Layout: ' . $beLayoutTitle . '</h3>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment