Deprecation: #88787 - BackendUtility::editOnClick

See forge#88787

Description

The method \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick() used to generate JavaScript onclick targets to \TYPO3\CMS\Backend\Controller\EditDocumentController has been marked as deprecated.

Impact

Using this method will trigger PHP E_USER_DEPRECATED error.

Affected Installations

All installations with extensions using \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick() are affected.

Migration

Migrate the method to use the \TYPO3\CMS\Backend\Routing\UriBuilder API and attach the parameters manually.

Example:

// Previous
$old = BackendUtility::editOnClick($params);

// Migrated
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);

// Variant 1
$params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1';
$migrated = $uriBuilder->buildUriFromRoute('record_edit') . $params
    . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'));

// Variant 2
$params = [
    'edit' => [
        'pages' => [
            $pid => 'new',
        ],
     ],
     'returnNewPageId' => 1,
     'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'),
];
$migrated = (string)$uriBuilder->buildUriFromRoute('record_edit', params);
Copied!