From 23599cf42cf1d3190b1b9fa269f893d212cfa26b Mon Sep 17 00:00:00 2001 From: Nikita Hovratov Date: Fri, 8 Mar 2024 21:46:28 +0100 Subject: [PATCH] [TASK] Drop old Hooks --- Classes/Hooks/PageLayoutViewDrawItem.php | 142 ----------------------- Classes/Hooks/PageLayoutViewHook.php | 39 ------- ext_localconf.php | 5 - 3 files changed, 186 deletions(-) delete mode 100644 Classes/Hooks/PageLayoutViewDrawItem.php delete mode 100644 Classes/Hooks/PageLayoutViewHook.php diff --git a/Classes/Hooks/PageLayoutViewDrawItem.php b/Classes/Hooks/PageLayoutViewDrawItem.php deleted file mode 100644 index 176ad414..00000000 --- a/Classes/Hooks/PageLayoutViewDrawItem.php +++ /dev/null @@ -1,142 +0,0 @@ -get('mask'); - $inlineHelper = GeneralUtility::makeInstance(InlineHelper::class); - $tableDefinitionCollection = GeneralUtility::makeInstance(LoaderRegistry::class)->getActiveLoader()->load(); - - // only render special backend preview if it is a mask element - if (!AffixUtility::hasMaskCTypePrefix($row['CType'])) { - return; - } - - $elementKey = AffixUtility::removeCTypePrefix($row['CType']); - $elementTcaDefinition = $tableDefinitionCollection->loadElement('tt_content', $elementKey); - // If the Mask element couldn't be found, provide a proper error message. - if (!$elementTcaDefinition instanceof ElementTcaDefinition) { - $drawItem = false; - $itemContent = '' - . sprintf($this->getLanguageService()->sL('LLL:EXT:mask/Resources/Private/Language/locallang.xlf:tx_mask.error.mask_definition_missing'), $elementKey) - . ''; - return; - } - - // fallback to prevent breaking change - $templatePathAndFilename = TemplatePathUtility::getTemplatePath( - $maskExtensionConfiguration, - $elementKey, - false, - GeneralUtility::getFileAbsFileName($maskExtensionConfiguration['backend'] ?? '') - ); - - // User defined backend preview exists. Turn off TYPO3 auto preview. - if (!file_exists($templatePathAndFilename)) { - return; - } - - // Turn off TYPO3 auto preview rendering. - $drawItem = false; - - // initialize view - $view = GeneralUtility::makeInstance(StandaloneView::class); - - // Load the backend template - $view->setTemplatePathAndFilename($templatePathAndFilename); - - // if there are paths for layouts and partials set, add them to the view - if (!empty($maskExtensionConfiguration['layouts_backend'])) { - $layoutRootPath = GeneralUtility::getFileAbsFileName($maskExtensionConfiguration['layouts_backend']); - $view->setLayoutRootPaths([$layoutRootPath]); - } - if (!empty($maskExtensionConfiguration['partials_backend'])) { - $partialRootPath = GeneralUtility::getFileAbsFileName($maskExtensionConfiguration['partials_backend']); - $view->setPartialRootPaths([$partialRootPath]); - } - - // Fetch and assign some useful variables - $data = BackendUtility::getRecordWSOL('tt_content', (int)$row['uid']); - $inlineHelper->addFilesToData($data); - $inlineHelper->addIrreToData($data); - - $view->assign('row', $row); - $view->assign('data', $data); - - // Translate element label - $elementLabel = $this->getLanguageService()->sL($elementTcaDefinition->elementDefinition->label); - - // Render everything - $content = $view->render(); - $editElementUrlParameters = [ - 'edit' => [ - 'tt_content' => [ - $row['uid'] => 'edit', - ], - ], - 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() . '#element-tt_content-' . $row['uid'], - ]; - - $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); - $editElementUrl = $uriBuilder->buildUriFromRoute('record_edit', $editElementUrlParameters); - $headerContent = '' . $elementLabel . '
'; - $itemContent .= '
'; - $itemContent .= $content; - $itemContent .= '
'; - } - - protected function getLanguageService(): LanguageService - { - return $GLOBALS['LANG']; - } -} diff --git a/Classes/Hooks/PageLayoutViewHook.php b/Classes/Hooks/PageLayoutViewHook.php deleted file mode 100644 index 59f99c7f..00000000 --- a/Classes/Hooks/PageLayoutViewHook.php +++ /dev/null @@ -1,39 +0,0 @@ - \MASK\Mask\Fluid\FluidTemplateContentObject::class, ]; -// Hook to override tt_content backend_preview -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['mask'] = \MASK\Mask\Hooks\PageLayoutViewDrawItem::class; -// Hook to override colpos check for unused tt_content elements -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['record_is_used'][] = \MASK\Mask\Hooks\PageLayoutViewHook::class . '->contentIsUsed'; - // Extend Page Tca Fields specific for backend layout $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['formDataGroup']['tcaDatabaseRecord'][\MASK\Mask\Form\FormDataProvider\TcaTypesShowitemMaskBeLayoutFields::class] = [ 'depends' => [