Feature: #92358 - Add getModuleTemplate() to PageLayoutController
See forge#92358
Description
The
\TYPO3\
features
two hooks for manipulating the "Page" module.
draw
and
draw
. Those hooks already
receive the parent object
Page
. 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
get
. 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
->makeLinkButton()
->setHref('/typo3/some/url')
->setTitle('My custom button')
->setClasses('custom-link-class')
->setIcon($moduleTemplate->getIconFactory()->getIcon('actions-link', Icon::SIZE_SMALL));
$buttonBar->addButton($linkButton);
}
Impact
When using either the
draw
or the
draw
of the
Page
, the provided parent object now contains
the
get
method, which can be used to retrieve
the corresponding
\TYPO3\
instance.
This provides more flexibility to third party code manipulating the "Page"
module view.