view->assign('controllerName', 'DeleteConstant'); $this->prepareExtensionAndLangFileOptions(); $this->configurationService->initFileObject( $this->session->getDataByKey('languageFileSelection'), $this->session->getDataByKey('extensionSelection') ); $fileObject = $this->configurationService->getFileObj(); if ($this->session->getDataByKey('editingMode') === 'override') { /** @var FileOverrideService $overrideFileObject */ $overrideFileObject = $fileObject; $overrideFileObject->deleteDuplicates(); } $langData = $fileObject->getLocalLangData(); $constantOptions = $this->configurationService->menuConstList( $langData, LocalizationUtility::translate('select.nothing', 'lfeditor') ); $this->assignViewWidthMenuVariables('constant', $constantOptions); $this->prepareDeleteConstantViewMainSectionContent(); } catch (LFException $e) { $this->addLFEFlashMessage($e); } $this->commonViewRenderingActionSettings(); if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { $this->view->assign('V11', FALSE); return NULL; } else { $this->view->assign('V11', TRUE); return $this->createBackendResponse(); } } /** * This action saves in session currently selected options from selection menus in deleteConstant view. * It is called on change of selection of any select menu in deleteConstant view. * * @param string $extensionSelection * @param string $languageFileSelection * @param string $constantSelection * @param string $extKey * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException */ public function changeSelectionAction( $extensionSelection = NULL, $languageFileSelection = NULL, $constantSelection = NULL, $extKey = '' ): ?\Psr\Http\Message\ResponseInterface { $this->saveSelectionsInSession( $extensionSelection, $languageFileSelection, NULL, $constantSelection, NULL, NULL, NULL, NULL, $extKey ); if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { $this->redirect('deleteConstant'); return NULL; } else { return $this->redirect('deleteConstant'); } } /** * Saves the changes made in main section of deleteConstant view. * * @return \Psr\Http\Message\ResponseInterface|null * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException */ public function deleteConstantSaveAction(): ?\Psr\Http\Message\ResponseInterface { try { $constantSelection = $this->session->getDataByKey('constantSelection'); $langArray = Functions::buildLangArray(); // build modArray $newLang = []; foreach ($langArray as $lang) { $newLang[$lang][$constantSelection] = ''; } $this->configurationService->execWrite($newLang, [], TRUE); $this->addFlashMessage( LocalizationUtility::translate('lang.file.write.success', 'lfeditor'), '', $severity = AbstractMessage::OK, $storeInSession = TRUE ); } catch (LFException $e) { $this->addLFEFlashMessage($e); } if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { $this->redirect('deleteConstant'); return NULL; } else { return $this->redirect('deleteConstant'); } } /** * Clears extensionAndLangFileOptions cache, and in that way refreshes list of language file options in select box. * * @return \Psr\Http\Message\ResponseInterface|null * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException */ public function refreshLanguageFileListAction(): ?\Psr\Http\Message\ResponseInterface { $this->clearSelectOptionsCache('extensionAndLangFileOptions'); if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { $this->redirect('deleteConstant'); return NULL; } else { return $this->redirect('deleteConstant'); } } /** * Prepares main section content of deleteConstant view. * * @throws LFException * @return void */ protected function prepareDeleteConstantViewMainSectionContent() { $constantSelection = $this->session->getDataByKey('constantSelection'); if (empty($constantSelection) || $constantSelection == '###default###') { throw new LFException('failure.select.noConst', 1); } $this->view->assign('constantSelection', $constantSelection); } }