[FOLLOWUP] Clean up 7.2 documentation
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / 7.2 / Feature-65767-SystemInformationDropdown.rst
1 =============================================
2 Feature: #65767 - System Information Dropdown
3 =============================================
4
5 Description
6 ===========
7
8 A new, extensible flyout menu item is introduced that contains information about
9 the system TYPO3 is installed on.
10
11
12 Impact
13 ======
14
15 In a default installation. the new flyout item will be placed between the "help" and the "user"
16 flyout items and is accessible by administrators only.
17
18 Items
19 ^^^^^
20
21 It is possible to add own system information items by creating a slot. The slot must be registered in
22 an extension's ext_localconf.php
23
24 .. code-block:: php
25
26 $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
27 $signalSlotDispatcher->connect(
28 \TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem::class,
29 'getSystemInformation',
30 \Vendor\Extension\SystemInformation\Item::class,
31 'getItem'
32 );
33
34 This requires the class `Item` and its method `getItem()` in EXT:extension\Classes\SystemInformation\Item.php:
35
36 .. code-block:: php
37
38 class Item {
39 public function getItem() {
40 return array(array(
41 'title' => 'The title shown on hover',
42 'value' => 'Description shown in the list',
43 'status' => SystemInformationHookInterface::STATUS_OK,
44 'count' => 4,
45 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('extensions-example-information-icon')
46 ));
47 }
48 }
49
50 Due to the SignalSlot internals, the data array must be encapsulated with another array! If there is no data to return, return `NULL`.
51
52 The icon `extensions-example-information-icon` must be registered in ext_localconf.php:
53
54 .. code-block:: php
55
56 \TYPO3\CMS\Backend\Sprite\SpriteManager::addSingleIcons(
57 array(
58 'information-icon' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Images/Icons/information-icon.png'
59 ),
60 $_EXTKEY
61 );
62
63 "extensions-" is a hardcoded prefix, combined with `$_EXTKEY` (e.g. "example") creates the prefix "extensions-example-" to
64 be used with every icon being registered. Since the first parameter of `SpriteManager::addSingleIcons()` is an array, multiple icons
65 can be registered at once.
66
67
68 Messages
69 ^^^^^^^^
70
71 Messages are shown at the bottom og the dropdown. An extension can provide its own slot to fill the messages:
72
73 .. code-block:: php
74
75 $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
76 $signalSlotDispatcher->connect(
77 \TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem::class,
78 'loadMessages',
79 \Vendor\Extension\SystemInformation\Message::class,
80 'getMessage'
81 );
82
83 This requires the class `Message` and its method `getMessage()` in EXT:extension\Classes\SystemInformation\Message.php:
84
85 .. code-block:: php
86
87 class Message {
88 public function getMessage() {
89 return array(array(
90 'status' => SystemInformationHookInterface::STATUS_OK,
91 'text' => 'Something went somewhere terribly wrong. Take a look at the reports module.'
92 ));
93 }
94 }
95
96 Due to the SignalSlot internals, the data array must be encapsulated with another array! If there is no data to return, return `NULL`.