diff --git a/Classes/FrontendEditPanel.php b/Classes/FrontendEditPanel.php index 22d4518..d6af844 100644 --- a/Classes/FrontendEditPanel.php +++ b/Classes/FrontendEditPanel.php @@ -96,7 +96,7 @@ class FrontendEditPanel $this->frontendController->set_no_cache('Frontend edit panel is shown', true); $formName = 'TSFE_EDIT_FORM_' . substr($this->frontendController->uniqueHash(), 0, 4); - $formTag = '
'; // Wrap the panel if ($conf['innerWrap']) { @@ -215,7 +215,7 @@ class FrontendEditPanel // Special content is about to be shown, so the cache must be disabled. $this->frontendController->set_no_cache('Display frontend edit icons', true); $iconTitle = $this->cObj->stdWrap($conf['iconTitle'], $conf['iconTitle.']); - $iconImg = '' + $iconImg = '' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render('inline') . ''; $noView = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0; @@ -317,14 +317,10 @@ class FrontendEditPanel ); } } else { - if ($confirm && $this->backendUser->jsConfirmation(JsConfirmation::FE_EDIT)) { - // Gets htmlspecialchared later - $cf1 = 'if (confirm(' . GeneralUtility::quoteJSvalue($confirm) . ')) {'; - $cf2 = '}'; - } else { - $cf1 = ($cf2 = ''); + if ($confirm && $this->backendUser->jsConfirmation(JsConfirmation::FE_EDIT) === false) { + $confirm = ''; } - $out = '' . $string . ''; + $out = '' . $string . ''; } return $out; } @@ -340,10 +336,10 @@ class FrontendEditPanel */ protected function editPanelLinkWrap_doWrap($string, $url, $additionalClasses = '') { - $width = MathUtility::forceIntegerInRange($this->backendUser->getTSConfig()['options.']['feedit.']['popupWidth'] ?? 690, 690, 5000, 690); - $height = MathUtility::forceIntegerInRange($this->backendUser->getTSConfig()['options.']['feedit.']['popupHeight'] ?? 500, 500, 5000, 500); - $onclick = 'vHWin=window.open(' . GeneralUtility::quoteJSvalue($url . '&returnUrl=' . rawurlencode(PathUtility::getAbsoluteWebPath(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Public/Html/Close.html')))) . ',\'FEquickEditWindow\',\'width=' . $width . ',height=' . $height . ',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;'; - return '' . $string . ''; + $classes = 'typo3-editPanel-btn typo3-editPanel-btn-default typo3-feedit-btn-openBackend frontEndEditIconLinks ' . htmlspecialchars($additionalClasses); + return 'getDataAttributes($url) . '>' . + $string . + ''; } /** @@ -395,6 +391,22 @@ class FrontendEditPanel return htmlspecialchars($this->getLanguageService()->getLL($key)); } + /** + * Returns data attributes to call the provided url via JavaScript. + * + * @param string $url The url to call via JavaScript. + * @return string Data attributes without whitespace at beginning or end. + */ + protected function getDataAttributes(string $url): string + { + $t3BeSitenameMd5 = md5('Typo3Backend-' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']); + + return implode(' ', [ + 'data-backendScript="' . $url . '"', + 'data-t3BeSitenameMd5="' . $t3BeSitenameMd5 . '"', + ]); + } + /** * Returns the returnUrl used by TYPO3. Add this as "returnUrl=" to any url that allows the user to go back or close an form. * diff --git a/Classes/Service/EditToolbarService.php b/Classes/Service/EditToolbarService.php index 94d387f..8ee4afe 100644 --- a/Classes/Service/EditToolbarService.php +++ b/Classes/Service/EditToolbarService.php @@ -56,7 +56,7 @@ class EditToolbarService $langAllowed = $this->getBackendUser()->checkLanguageAccess($languageAspect->getId()); $id = $tsfe->id; $returnUrl = GeneralUtility::getIndpEnv('REQUEST_URI'); - $classes = 'typo3-adminPanel-btn typo3-adminPanel-btn-default typo3-adminPanel-btn-openBackend'; + $classes = 'typo3-adminPanel-btn typo3-adminPanel-btn-default typo3-feedit-btn-openBackend'; $output = []; $output[] = '