#91123Avoid inline JavaScript generated by BackendUtility:viewOnClick
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
- main 74499[FEATURE] Replace hooks with events for Preview URI generation
- main 70153[TASK] Move a Changelog file to correct directory
- main 64302[TASK] Deprecate BackendUtility::viewOnClick
- main 64243[TASK] Avoid inline JavaScript generated by BackendUtility:viewOnClick
- 10.4 65052[TASK] Avoid inline JavaScript generated by BackendUtility:viewOnClick
Related issues 6
- Task #91806Deprecate BackendUtility::viewOnClick
- Task #91813Replace window.open JavaScript with WindowManager
- Bug #93065TypeError using the page module
- Task #94667Move a Changelog file to correct directory
- Task #96141Remove deprecated BackendUtility::viewOnClick
- Feature #97544Replace hooks with events for Preview URL generation