[TYPO3-dev] 6.0 Breaking change Toolbaritems

Ernesto Baschny [cron IT] ernst at cron-it.de
Thu Nov 29 13:45:46 CET 2012


Kay Strobach schrieb am 28.11.2012 07:14:

> was it the intention to change the toolbaritem interface to be
> incompatible to all version below 6.0 code?
> 
> The "old" and now deprecated interface required a function __construct
> like this one:
> 
> public function __construct(TYPO3backend &$backendReference = null) {
> 
> The new one requires a namespaced Version.
> 
> __construct(\TYPO3\CMS\Backend\Controller\BackendController
> &$backendReference = NULL);
> 
> To be compatible i have to include 2 Versions of the same class, where
> the only difference is the constructor - not good :(
> 
> Will this happen on all places where Hook Interfaces are use? - I'm
> currently investigating that stuff :(

The solution is simple, I did that for extdeveval already (patch
attached to  http://forge.typo3.org/issues/43444):

1) Make sure you register your toobarItem in a php file which does *not*
include the class definition itself. The registration PHP file should
only call the "$GLOBALS['TYPO3backend']->addToolbarItem" method.

2) Make sure the class you are declaring as an implementation of
"backend_toolbarItem" can be properly auto-loaded by TYPO3.

If these two conditions are met, your toolbarItem will work without a
problem in TYPO3 4.5 throughout 6.0.

Cheers,
Ernesto




More information about the TYPO3-dev mailing list