[TYPO3-dev] 6.0 Breaking change Toolbaritems
Ernesto Baschny [cron IT]
ernst at cron-it.de
Thu Nov 29 11:12:01 CET 2012
Hi Thomas,
Thomas Maroschik schrieb am 28.11.2012 10:00:
> could you please tell me what the following code outputs?
>
> echo PHP_VERSION_ID . PHP_EOL;
>
> There is a switch in TYPO3\CMS\Core\Bootstrap::registerAutoloader that
> recognizes versions below 5.3.7 and tries to rewrite them accordingly.
This works fine for most situations, but in this particular case the
auto-loader is *not* being used because in backend.php the hook
interface is being "include_once" directly:
// Include extensions which may add css, javascript or toolbar items
if
(is_array($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems']))
{
foreach
($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems']
as $additionalBackendItem) {
include_once $additionalBackendItem;
}
}
In this case $additionalBackendItem is the filename to load, but
unfortunately this file has not only the interface defined, but also the
call to $GLOBALS['TYPO3backend']->addToolbarItem which is what registers
the functionality of the Toolbar.
For example in Workspaces this is the file with the interface
WorkspaceSelectorToolbarItem. At the end, there is this call:
if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) {
$GLOBALS['TYPO3backend']->addToolbarItem('workSpaceSelector',
'TYPO3\\CMS\\Workspaces\\ExtDirect\\WorkspaceSelectorToolbarItem');
}
In an ideal world the "additionalBackendItems" should only contain the
call to "addToolbarItem" and not the interface itself (which should be
auto-loaded). The "include_once" in backend.php is thus needed and
cannot be removed.
extdeveval is somehow strange:
In ext_localconf.php it has:
$GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'][] = t3lib_extMgm::extPath('extdeveval').'class.tx_extdeveval_additionalBackendItems.php';
In ext_tables.php:
$GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'][] = t3lib_extMgm::extPath('extdeveval') . 'registerToolbarItem.php';
Thus, it registers itself twice. A solution - in this case - is to
modify extdeveval:
1) Remove the direct registration of the class (in ext_localconf.php).
2) Remove the include_once done in registerToolbarItem.php, and keep
only the call to addToolbarItem()
I will post a fix proposal to the extdeveval issue tracker.
Anyhow, this is "only" a problem with PHP<5.2.7 and *not* backwards
compatible. But to solve it, it requires (a tiny) change in extensions.
But at least the modified extension will still work on any TYPO3 which
includes auto-loading functionality.
Cheers,
Ernesto
More information about the TYPO3-dev
mailing list