Commit 4973abb6 authored by Dan Untenzu's avatar Dan Untenzu Committed by Susanne Moog
Browse files

[BUGFIX] Set anchor in all preview links of content elements

The button »View webpage« in the list module opens a popup
with a link to the current page and an anchor to the
selected content element. This behaviour is expected as well
while selecting the »Show« option in the context menu of
content elements or the »Save and view page« button in
edit forms. Both places didn't added the anchor.

Resolves: #81250
Releases: master, 8.7
Change-Id: Ifa8da940eb12820f9b0c54957928fd8d9f3703b5
Reviewed-on: https://review.typo3.org/53395


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Tested-by: Jan Helke's avatarJan Helke <typo3@helke.de>
Reviewed-by: Henning Liebe's avatarHenning Liebe <h.liebe@neusta.de>
Tested-by: Henning Liebe's avatarHenning Liebe <h.liebe@neusta.de>
Reviewed-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Tested-by: default avatarJoerg Boesche <typo3@joergboesche.de>
Reviewed-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
parent a01a7462
......@@ -416,7 +416,13 @@ class RecordProvider extends AbstractProvider
*/
protected function getViewLink(): string
{
$javascriptLink = BackendUtility::viewOnClick($this->getPreviewPid());
$anchorSection = $this->table === 'tt_content' ? '#c' . $this->record['uid'] : '';
$javascriptLink = BackendUtility::viewOnClick(
$this->getPreviewPid(),
'',
null,
$anchorSection
);
$extractedLink = '';
if (preg_match('/window\\.open\\(\'([^\']+)\'/i', $javascriptLink, $match)) {
// Clean JSON-serialized ampersands ('&')
......
......@@ -866,6 +866,9 @@ class EditDocumentController extends AbstractModule
$linkParameters = array_replace($linkParameters, $additionalGetParameters);
}
// anchor with uid of content element]
$anchorSection = $table === 'tt_content' ? '#c' . $recordId : '';
$this->popViewId = $previewPageId;
$this->popViewId_addParams = GeneralUtility::implodeArrayForUrl('', $linkParameters, '', false, true);
......@@ -877,7 +880,7 @@ class EditDocumentController extends AbstractModule
$this->popViewId,
'',
$previewPageRootline,
'',
$anchorSection,
$this->viewUrl,
$this->popViewId_addParams,
false
......@@ -889,7 +892,7 @@ class EditDocumentController extends AbstractModule
$this->popViewId,
'',
$previewPageRootline,
'',
$anchorSection,
$this->viewUrl,
$this->popViewId_addParams
)
......
Supports Markdown
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