谁能告诉我,在Typo3的后端添加自己的按钮的方法是什么?它应该出现在那里:
提前THX !!
答案 0 :(得分:1)
TYPO3 6.2: 使用文件... / typo3_src-6.2.4 / typo3 / sysext / backend / Classes / Controller / BackendController.php及其方法addToolbarItem。
/**
* Adds an item to the toolbar, the class file for the toolbar item must be loaded at this point
*
* @param string $toolbarItemName Toolbar item name, f.e. tx_toolbarExtension_coolItem
* @param string $toolbarItemClassName Toolbar item class name, f.e. tx_toolbarExtension_coolItem
* @return void
* @throws \UnexpectedValueException
*/
public function addToolbarItem($toolbarItemName, $toolbarItemClassName) {
$toolbarItem = GeneralUtility::makeInstance($toolbarItemClassName, $this);
if (!$toolbarItem instanceof \TYPO3\CMS\Backend\Toolbar\ToolbarItemHookInterface) {
throw new \UnexpectedValueException('$toolbarItem "' . $toolbarItemName . '" must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ToolbarItemHookInterface', 1195125501);
}
if ($toolbarItem->checkAccess()) {
$this->toolbarItems[$toolbarItemName] = $toolbarItem;
} else {
unset($toolbarItem);
}
}
以与opendocs系统扩展相同的方式执行此操作。
if (TYPO3_MODE === 'BE') {
// Now register the class as toolbar item
$GLOBALS['TYPO3backend']->addToolbarItem('opendocs', 'TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController');
}
参见文件... / typo3_src-6.2.4 / typo3 / sysext / opendocs / Classes / Controller / OpendocsController.php:
class OpendocsController implements \TYPO3\CMS\Backend\Toolbar\ToolbarItemHookInterface {