Skip to content
Snippets Groups Projects
Commit f16b4787 authored by Oliver Hader's avatar Oliver Hader Committed by Benni Mack
Browse files

[TASK] Avoid inline JavaScript generated by BackendUtility:viewOnClick

Inline JavaScript produced by BackendUtility:viewOnClick is substituted
with markup based instructions and static JavaScript event handlers.

// basically delivers window.open(generatedUri)
BackendUtility::viewOnClick($pageId, $backPath, $rootLine, $section,
    $viewUri, $getVars, $switchFocus);

can be substituted with e.g.

\TYPO3\CMS\Backend\Routing\PreviewUriBuilder::create($pageId, $viewUri)
    ->withRootLine($rootLine)
    ->withSection($section)
    ->withAdditionalQueryParameters($getVars)
    ->serializeDispatcherAttributes([
        PreviewUriBuilder::OPTION_SWITCH_FOCUS => $switchFocus,
    ]);

which results in the following HTML data attributes
(data can be retrieved as array of complete element as well)

data-dispatch-action="TYPO3.WindowManager.localOpen"
data-dispatch-args="["https://...",null,"previewWin"]"

Resolves: #91123
Releases: master
Change-Id: Iedd9bfe60827977677ee68e2c948c63e359abf84
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64243


Tested-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent a7bade17
No related merge requests found
Showing
with 493 additions and 99 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment