Feature: #65767 - System Information Dropdown
See forge#65767
Description
A new, extensible flyout menu item is introduced that contains information about the system TYPO3 is installed on.
Impact
In a default installation. the new flyout item will be placed between the "help" and the "user" flyout items and is accessible by administrators only.
Items
It is possible to add own system information items by creating a slot. The slot must be registered in an extension's ext_localconf.php
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
$signalSlotDispatcher->connect(
\TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem::class,
'getSystemInformation',
\Vendor\Extension\SystemInformation\Item::class,
'getItem'
);
This requires the class Item
and its method get
in EXT:extensionClassesSystemInformationItem.php:
class Item {
public function getItem() {
return array(array(
'title' => 'The title shown on hover',
'value' => 'Description shown in the list',
'status' => SystemInformationHookInterface::STATUS_OK,
'count' => 4,
'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('extensions-example-information-icon')
));
}
}
Due to the SignalSlot internals, the data array must be encapsulated with another array! If there is no data to return, return NULL
.
The icon extensions-
must be registered in ext_localconf.php:
\TYPO3\CMS\Backend\Sprite\SpriteManager::addSingleIcons(
array(
'information-icon' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Images/Icons/information-icon.png'
),
$_EXTKEY
);
"extensions-" is a hardcoded prefix, combined with $_
(e.g. "example") creates the prefix "extensions-example-" to
be used with every icon being registered. Since the first parameter of Sprite
is an array, multiple icons
can be registered at once.
Messages
Messages are shown at the bottom og the dropdown. An extension can provide its own slot to fill the messages:
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
$signalSlotDispatcher->connect(
\TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem::class,
'loadMessages',
\Vendor\Extension\SystemInformation\Message::class,
'getMessage'
);
This requires the class Message
and its method get
in EXT:extensionClassesSystemInformationMessage.php:
class Message {
public function getMessage() {
return array(array(
'status' => SystemInformationHookInterface::STATUS_OK,
'text' => 'Something went somewhere terribly wrong. Take a look at the reports module.'
));
}
}
Due to the SignalSlot internals, the data array must be encapsulated with another array! If there is no data to return, return NULL
.