Breaking: #78192 - Refactor click menu (context menu)¶
See forge#78192
Description¶
Due to the refactoring and unification of the click/context-menu handling in the TYPO3 Backend, a few breaking changes have been introduced.
Classes removed¶
\TYPO3\CMS\Backend\ClickMenu\ClickMenu
\TYPO3\CMS\Backend\ContextMenu\ContextMenuAction
\TYPO3\CMS\Backend\ContextMenu\ContextMenuActionCollection
\TYPO3\CMS\Backend\ContextMenu\Pagetree\ContextMenuDataProvider
\TYPO3\CMS\Backend\ContextMenu\Pagetree\Extdirect\ContextMenuConfiguration
\TYPO3\CMS\Backend\Controller\ClickMenuController
\TYPO3\CMS\Impexp\Clickmenu
(replaced by new hook implementation:TYPO3\CMS\Impexp\Hook\ContextMenuModifyItemsHook
)\TYPO3\CMS\Impexp\Hook\ContextMenuDisableItemsHook
\TYPO3\CMS\Version\ClickMenu\VersionClickMenu
ExtJS component removed¶
The
TYPO3.Components.PageTree.ContextMenu
component defined in contextmenu.js has been removed.The
contextMenuProvider
property as well asenableContextMenu
andopenContextMenu
methods of theTYPO3.Components.PageTree.Tree
component have been removed.
Migration¶
Migrate your code to a requireJS module for custom click-menu actions.
ClickMenu requireJS component removed¶
The TYPO3/CMS/Backend/ClickMenu
requireJS component (ClickMenu.js) has been removed.
Migration¶
Use the new requireJS component: TYPO3/CMS/Backend/ContextMenu
.
Page TSConfig change¶
The pagetree context-menu configuration in Page TSConfig has been removed (except for the disableItems
part).
The list of available menu items is now provided by ItemProviders
e.g. \TYPO3\CMS\Backend\ContextMenu\ItemProviders\PageProvider
.
The TSConfig options for disabling click-menu items has been streamlined.
Also some items names have changed (e.g. new_wizard
is now called newWizard
, db_list
is now openListModule
). Refer to the provider class for correct naming.
Migration¶
Migrate TSConfig from:
options.contextMenu.folderList.disableItems
to options.contextMenu.table.sys_file.disableItems
options.contextMenu.folderTree.disableItems
to options.contextMenu.table.sys_file.tree.disableItems
options.contextMenu.pageList.disableItems
to options.contextMenu.table.pages.disableItems
options.contextMenu.pageTree.disableItems
to options.contextMenu.table.pages.tree.disableItems
Hooks removed¶
The following two hooks have been removed:
$GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses']
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['backend']['contextMenu']['disableItems']
Migration¶
Use the new ItemsProvider API to add or modify click-menu items.
See existing usage of the API in the core TYPO3\CMS\Filelist\ContextMenu\ItemProviders\FileProvider
or \TYPO3\CMS\Beuser\ContextMenu\ItemProvider
.
Legacy Tree¶
Support for drag & drop menu for LegacyTree.js of pages has been dropped.
Changed markup (data attributes) for click menu¶
data-listFrame
has been replaced with the optional attributedata-context
attribute. Context is set to "tree" for click-menus triggered from trees.- for files,
data-table
now contains the real table name "sys_file" while before it contained the combined identifier e.g.1:/fileadmin/file.jpg
. the
data-uid
attribute now contains the combined identifier of the file (before it was empty). Thus thedata-uid
attribute value is not always an int.
- for files,
the class which triggers the context-menu has changed from
t3-js-clickmenutrigger
tot3js-contextmenutrigger
Migration¶
To trigger click-menus for files, use the correct class-attribute as well as the table and uid data attributes. Replace data-listFrame="0"
with data-context="tree"
, data-listFrame="1"
can be removed (it's a default context now).
Impact¶
Instantiating the PHP class will result in a fatal PHP error. Accessing removed JavaScript properties will result in a JavaScript error.
Removed hooks will not influence the menu rendering process.
Affected Installations¶
Any installation using the removed PHP classes, JS components or hooks.
Migration¶
Adapt your code to the new click menu API.