Issue Task Closed

#91123Avoid inline JavaScript generated by BackendUtility:viewOnClick

Oliver Hader 04/18/20, 22:56 updated 12/22/20, 11:09

Description

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="["...uri...",null,"previewWin"]"

Reviews 5