Project

General

Profile

Actions

Bug #59959

closed

LiveSearchToolbarItem not initialized correctly in \sysext\backend\Classes\Controller\BackendController.php

Added by Gernot Schulmeister over 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2014-06-28
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

Description

in the function initializeCoreToolbarItems() line 138 the path to the LiveSearchToolbarItem class is not set correctly but escaped with a double back slash at the beginning (line 142), compare with the Shortcut and ClearCache Toolbar Items

$coreToolbarItems = array(
'shortcuts' => 'TYPO3\\CMS\\Backend\\Toolbar\\ShortcutToolbarItem',
'clearCacheActions' => 'TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheToolbarItem',
'liveSearch' => '\\TYPO3\\CMS\\Backend\\Toolbar\\LiveSearchToolbarItem'
);

The consequence is that the LiveSearchToolbarItem Class cannot be extended (former XClass) using the naming conventions because the Extension class is not detected by the GeneralUtility:makeInstance() function. So

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Backend\\Toolbar\\LiveSearchToolbarItem'] = array('className' => 'somePath');

will not work, instead you have to use

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['\TYPO3\\CMS\\Backend\\Toolbar\\LiveSearchToolbarItem'] = array('className' => 'somePath');

to get the LiveSearchToolbarItem class extended at the moment.

protected function initializeCoreToolbarItems() {
$coreToolbarItems = array(
'shortcuts' => 'TYPO3\\CMS\\Backend\\Toolbar\\ShortcutToolbarItem',
'clearCacheActions' => 'TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheToolbarItem',
'liveSearch' => '\\TYPO3\\CMS\\Backend\\Toolbar\\LiveSearchToolbarItem'
);
foreach ($coreToolbarItems as $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', 1195126772);
}
if ($toolbarItem->checkAccess()) {
$this->toolbarItems[$toolbarItemName] = $toolbarItem;
} else {
unset($toolbarItem);
}
}
}

Solution remove the first \\ in line 142 to make an instance of the LiveSearchToolbarItem

Actions

Also available in: Atom PDF