Created
June 27, 2023 13:14
-
-
Save kitzberger/e5954e5d349b90123fdf2ce97b78e7d9 to your computer and use it in GitHub Desktop.
TYPO3 PageModule Enhancements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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