Task #71362
closed
Add hook to manipulate docHeader buttons when using the ModuleTemplateAPI
Added by Frans Saris about 9 years ago.
Updated about 7 years ago.
Description
The "old" backend module rendering knows the $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook']
hook so you are able to manipulate the docHeader buttons. This isn't yet implemented in the new ModuleTemplateAPI
- Status changed from New to Under Review
To easily test the hook add next lines to your typo3conf/AdditionalConfiguration.php
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Backend\Template\Components\ButtonBar']['getButtonsHook']['HookTest'] =
function($params, TYPO3\CMS\Backend\Template\Components\ButtonBar $buttonBar) {
$buttons = $params['buttons'];
// if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M') === 'web_list') {
$iconFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconFactory::class);
$button = $buttonBar->makeLinkButton();
$button->setShowLabelText(true);
$button->setIcon($iconFactory->getIcon('actions-system-backend-user-emulate', \TYPO3\CMS\Core\Imaging\Icon::SIZE_SMALL));
$button->setTitle('getButtons hook test');
$button->setOnClick('alert("Hook works");return false;');
$buttons[\TYPO3\CMS\Backend\Template\Components\ButtonBar::BUTTON_POSITION_LEFT][1][] = $button;
// }
return $buttons;
};
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF