/** * Initialize the handler * * @param AbstractLinkBrowserController $linkBrowser * @param string $identifier * @param array $configuration Page TSconfig * * @return void */ public function initialize(AbstractLinkBrowserController $linkBrowser, $identifier, array $configuration) { $this->linkBrowser = $linkBrowser; $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $this->view = GeneralUtility::makeInstance(\TYPO3\CMS\Fluid\View\StandaloneView::class); $this->view->getRequest()->setControllerExtensionName('recordlist'); $this->view->setTemplateRootPaths([GeneralUtility::getFileAbsFileName('EXT:recordlist/Resources/Private/Templates/LinkBrowser')]); $this->view->setPartialRootPaths([GeneralUtility::getFileAbsFileName('EXT:recordlist/Resources/Private/Partials/LinkBrowser')]); $this->view->setLayoutRootPaths([GeneralUtility::getFileAbsFileName('EXT:recordlist/Resources/Private/Layouts/LinkBrowser')]); }
/** * inits the standalone fluid template */ public function initFluidTemplate() { $this->searchFormView = GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView'); $this->searchFormView->setPartialRootPaths([$this->conf['partialRootPath']]); $this->searchFormView->setLayoutRootPaths([$this->conf['layoutRootPath']]); $this->searchFormView->setTemplatePathAndFilename($this->conf['templateRootPath'] . 'SearchForm.html'); // make settings available in fluid template $this->searchFormView->assign('conf', $this->conf); $this->searchFormView->assign('extConf', $this->extConf); $this->searchFormView->assign('extConfPremium', $this->extConfPremium); }
/** * Initialize the handle action, sets up fluid stuff and assigns default variables. * * @return void */ protected function initializeHandle() { // Context service distinguishes between standalone and backend context $contextService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\ContextService::class); $viewRootPath = GeneralUtility::getFileAbsFileName('EXT:install/Resources/Private/'); $controllerActionDirectoryName = ucfirst($this->controller); $mainTemplate = ucfirst($this->action); $this->view = GeneralUtility::makeInstance(StandaloneView::class); $this->view->setTemplatePathAndFilename($viewRootPath . 'Templates/Action/' . $controllerActionDirectoryName . '/' . $mainTemplate . '.html'); $this->view->setLayoutRootPaths([$viewRootPath . 'Layouts/']); $this->view->setPartialRootPaths([$viewRootPath . 'Partials/']); $this->view->assign('time', time())->assign('action', $this->action)->assign('controller', $this->controller)->assign('token', $this->token)->assign('context', $contextService->getContextString())->assign('contextService', $contextService)->assign('lastError', $this->lastError)->assign('messages', $this->messages)->assign('typo3Version', TYPO3_version)->assign('siteName', $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']); }
/** * @test */ public function getPartialPathAndFilenameWalksStringKeysInReversedOrder() { $this->view->setPartialRootPaths(array('default' => 'some/Default/Directory', 'specific' => 'specific/Partials', 'verySpecific' => 'evenMore/Specific/Partials')); $this->mockRequest->expects($this->any())->method('getFormat')->will($this->returnValue('html')); $this->view->expects($this->at(0))->method('testFileExistence')->with(PATH_site . 'evenMore/Specific/Partials/Partial.html')->will($this->returnValue(false)); $this->view->expects($this->at(1))->method('testFileExistence')->with(PATH_site . 'evenMore/Specific/Partials/Partial')->will($this->returnValue(false)); $this->view->expects($this->at(2))->method('testFileExistence')->with(PATH_site . 'specific/Partials/Partial.html')->will($this->returnValue(false)); $this->view->expects($this->at(3))->method('testFileExistence')->with(PATH_site . 'specific/Partials/Partial')->will($this->returnValue(false)); $this->view->expects($this->at(4))->method('testFileExistence')->with(PATH_site . 'some/Default/Directory/Partial.html')->will($this->returnValue(false)); $this->view->expects($this->at(5))->method('testFileExistence')->with(PATH_site . 'some/Default/Directory/Partial')->will($this->returnValue(true)); $this->assertEquals(PATH_site . 'some/Default/Directory/Partial', $this->view->_call('getPartialPathAndFilename', 'Partial')); }
/** * Set partial root path if given in configuration * * @param array $conf Configuration array * @return void */ protected function setPartialRootPath(array $conf) { $partialPaths = []; if (isset($conf['partialRootPath']) || isset($conf['partialRootPath.'])) { $partialRootPath = isset($conf['partialRootPath.']) ? $this->cObj->stdWrap($conf['partialRootPath'], $conf['partialRootPath.']) : $conf['partialRootPath']; $partialPaths[] = GeneralUtility::getFileAbsFileName($partialRootPath); } if (isset($conf['partialRootPaths.'])) { $partialPaths = array_replace($partialPaths, $this->applyStandardWrapToFluidPaths($conf['partialRootPaths.'])); } if (!empty($partialPaths)) { $this->view->setPartialRootPaths($partialPaths); } }
/** * @return \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController */ public function __construct() { $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class); $this->getLanguageService()->includeLLFile('EXT:scheduler/Resources/Private/Language/locallang.xlf'); $this->MCONF = ['name' => $this->moduleName]; $this->cshKey = '_MOD_' . $this->moduleName; $this->backendTemplatePath = ExtensionManagementUtility::extPath('scheduler') . 'Resources/Private/Templates/Backend/SchedulerModule/'; $this->view = GeneralUtility::makeInstance(\TYPO3\CMS\Fluid\View\StandaloneView::class); $this->view->getRequest()->setControllerExtensionName('scheduler'); $this->view->setPartialRootPaths([ExtensionManagementUtility::extPath('scheduler') . 'Resources/Private/Partials/Backend/SchedulerModule/']); $this->moduleUri = BackendUtility::getModuleUrl($this->moduleName); $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal'); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/SplitButtons'); }
/** * Set partial root path if given in configuration * * @param array $conf Configuration array * @return void */ protected function setPartialRootPath(array $conf) { $partialPaths = array(); if (isset($conf['partialRootPath']) || isset($conf['partialRootPath.'])) { $partialRootPath = isset($conf['partialRootPath.']) ? $this->cObj->stdWrap($conf['partialRootPath'], $conf['partialRootPath.']) : $conf['partialRootPath']; $partialPaths[] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($partialRootPath); } if (isset($conf['partialRootPaths.'])) { foreach ($conf['partialRootPaths.'] as $key => $path) { $partialPaths[$key] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($path); } } if (!empty($partialPaths)) { $this->view->setPartialRootPaths($partialPaths); } }
/** * main method * * @return string */ public function main() { $this->view = $this->objectManager->get('\\TYPO3\\CMS\\Fluid\\View\\StandaloneView'); $this->view->getRequest()->setControllerExtensionName($this->getExtensionName()); $this->view->getRequest()->setPluginName('UpdateScript'); $this->view->getRequest()->setControllerName('UpdateScript'); $this->view->setLayoutRootPaths($this->getTemplateFolders('layout')); $this->view->setPartialRootPaths($this->getTemplateFolders('partial')); $this->view->assign('requestUri', GeneralUtility::getIndpEnv('REQUEST_URI')); $action = GeneralUtility::_GP('action') ? GeneralUtility::_GP('action') : 'Main'; if (is_callable(array($this, $action . 'Action'))) { $this->view->setTemplatePathAndFilename($this->getTemplatePath('UpdateScript/' . ucfirst($action) . '.html')); $content = call_user_func_array(array($this, $action . 'Action'), array()); } return $content; }
/** * Set partial root path if given in configuration * * @param array $conf Configuration array * @return void */ protected function setPartialRootPath(array $conf) { $partialPaths = array(); if (isset($conf['partialRootPath']) || isset($conf['partialRootPath.'])) { $partialRootPath = isset($conf['partialRootPath.']) ? $this->cObj->stdWrap($conf['partialRootPath'], $conf['partialRootPath.']) : $conf['partialRootPath']; $partialPaths[] = GeneralUtility::getFileAbsFileName($partialRootPath); } if (isset($conf['partialRootPaths.'])) { foreach ($conf['partialRootPaths.'] as $key => $path) { if (strpos($key, '.') === false) { $partialPaths[$key] = isset($conf['partialRootPaths.'][$key . '.']) ? GeneralUtility::getFileAbsFileName($this->cObj->stdWrap($conf['partialRootPaths.'][$key], $conf['partialRootPaths.'][$key . '.'])) : GeneralUtility::getFileAbsFileName($path); } } } if (!empty($partialPaths)) { $this->view->setPartialRootPaths($partialPaths); } }
/** * Add sys_notes as additional content to the footer of the page module * * @param array $params * @param PageLayoutController $parentObject * @return string */ public function render(array $params = array(), PageLayoutController $parentObject) { if ($parentObject->MOD_SETTINGS['function'] == 1) { $pageInfo = $parentObject->pageinfo; if ($this->pageCanBeIndexed($pageInfo)) { // template $this->loadCss(); $this->loadJavascript(); //load partial paths info from typoscript $this->view = GeneralUtility::makeInstance(StandaloneView::class); $this->view->setFormat('html'); $this->view->getRequest()->setControllerExtensionName('cs_seo'); $absoluteResourcesPath = ExtensionManagementUtility::extPath('cs_seo') . 'Resources/'; $layoutPaths = [$absoluteResourcesPath . 'Private/Layouts/']; $partialPaths = [$absoluteResourcesPath . 'Private/Partials/']; // load partial paths info from TypoScript if ($this->isTYPO3VersionGreather6) { /** @var ObjectManager $objectManager */ $objectManager = GeneralUtility::makeInstance(ObjectManager::class); /** @var ConfigurationManagerInterface $configurationManager */ $configurationManager = $objectManager->get(ConfigurationManagerInterface::class); $tsSetup = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'csseo'); $layoutPaths = $tsSetup["view"]["layoutRootPaths"] ?: $layoutPaths; $partialPaths = $tsSetup["view"]["partialRootPaths"] ?: $partialPaths; } $this->view->setLayoutRootPaths($layoutPaths); $this->view->setPartialRootPaths($partialPaths); $this->view->setTemplatePathAndFilename(ExtensionManagementUtility::extPath('cs_seo') . 'Resources/Private/Templates/PageHook.html'); $results = $this->getResults($pageInfo, $parentObject->current_sys_language); $score = $results['Percentage']; unset($results['Percentage']); $this->view->assignMultiple(['score' => $score, 'results' => $results, 'page' => $parentObject->pageinfo]); return $this->view->render(); } } }
/** * Class constructor * Sets up view and property objects * * @throws InvalidTemplateResourceException In case a template is invalid */ public function __construct() { $this->view = GeneralUtility::makeInstance(StandaloneView::class); $this->view->setPartialRootPaths($this->partialRootPaths); $this->view->setTemplateRootPaths($this->templateRootPaths); $this->view->setLayoutRootPaths($this->layoutRootPaths); $this->view->setTemplate($this->templateFile); $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class); $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); }
/** * Constructor */ public function __construct() { $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class); $this->presetRepository = GeneralUtility::makeInstance(PresetRepository::class); $templatePath = ExtensionManagementUtility::extPath('impexp') . 'Resources/Private/'; /* @var $view StandaloneView */ $this->standaloneView = GeneralUtility::makeInstance(StandaloneView::class); $this->standaloneView->setTemplateRootPaths([$templatePath . 'Templates/ImportExport/']); $this->standaloneView->setLayoutRootPaths([$templatePath . 'Layouts/']); $this->standaloneView->setPartialRootPaths([$templatePath . 'Partials/']); $this->standaloneView->getRequest()->setControllerExtensionName('impexp'); }