[BUGFIX] Set anchor in all preview links of content elements
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / ContextMenu / ItemProviders / RecordProvider.php
index b7633b0..ec401c8 100644 (file)
@@ -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 ('&')