Deprecation: #92132 - Shortcut PHP API

See forge#92132

Description

Some methods related to shortcut / bookmark handling in TYPO3 Backend have been marked as deprecated:

  • TYPO3\CMS\Backend\Template\ModuleTemplate->makeShortcutIcon()

  • TYPO3\CMS\Backend\Template\ModuleTemplate->makeShortcutUrl()

  • TYPO3\CMS\Backend\Template\Components\Buttons\Action\ShortcutButton->getSetVariables()

  • TYPO3\CMS\Backend\Template\Components\Buttons\Action\ShortcutButton->getGetVariables()

  • TYPO3\CMS\Backend\Template\Components\Buttons\Action\ShortcutButton->setGetVariables()

  • TYPO3\CMS\Backend\Template\Components\Buttons\Action\ShortcutButton->setSetVariables()

See also:

Impact

Using those methods directly or indirectly will trigger PHP E_USER_DEPRECATED errors.

Affected Installations

Extensions with backend modules that show the shortcut button in the doc header may be affected. The extension scanner will find all PHP usages as weak match.

Migration

The new method TYPO3\CMS\Backend\Template\Components\Buttons\Action\ShortcutButton->setArguments() has been introduced. This method expects the full set of arguments and values to create a shortcut to a specific view, example:

$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
$pageId = (int)($request->getQueryParams()['id'] ?? 0);
$shortCutButton = $buttonBar->makeShortcutButton()
    ->setRouteIdentifier('page_preview')
    ->setDisplayName('View page ' . $pageId)
    ->setArguments([
       'id' => $pageId,
    ]);
$buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT);