Feature: #92358 - Add getModuleTemplate() to PageLayoutController

See forge#92358


The TYPO3\CMS\Backend\Controller\PageLayoutController features two hooks for manipulating the "Page" module. drawHeaderHook and drawFooterHook. Those hooks already receive the parent object PageLayoutController. Since the calling code expects the hooks to return additional content, it was previously not possible to change other parts of the module, for example the module header.

To give developers more possibilities in manipulating the "Page" module, using the mentioned hooks, the parent object now contains a new getter method getModuleTemplate(). It can for example be used to add an additional button to the modules' button bar.

public function drawHeaderHook(array $parameters, PageLayoutController $parentObject)
   $moduleTemplate = $parentObject->getModuleTemplate();
   $buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar();

   $linkButton = $buttonBar
      ->setTitle('My custom button')
      ->setIcon($moduleTemplate->getIconFactory()->getIcon('actions-link', Icon::SIZE_SMALL));



When using either the drawHeaderHook or the drawFooterHook of the PageLayoutController, the provided parent object now contains the getModuleTemplate() method, which can be used to retrieve the corresponding \TYPO3\CMS\Backend\Template\ModuleTemplate instance. This provides more flexibility to third party code manipulating the "Page" module view.