getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'femanager'); if (!empty($configuration['view'][$part . 'RootPaths'] ?? '')) { $templatePaths = $configuration['view'][$part . 'RootPaths'] ?? ''; $templatePaths = array_values($templatePaths); } if ($returnAllPaths || empty($templatePaths)) { $path = $configuration['view'][$part . 'RootPath'] ?? ''; if (!empty($path)) { $templatePaths[] = $path; } } if ($returnAllPaths || empty($templatePaths)) { $templatePaths[] = 'EXT:femanager/Resources/Private/' . ucfirst($part) . 's/'; } $templatePaths = array_unique($templatePaths); $absolutePaths = []; foreach ($templatePaths as $templatePath) { $absolutePaths[] = GeneralUtility::getFileAbsFileName($templatePath); } return $absolutePaths; } /** * Return path and filename for a file or path. * Only the first existing file/path will be returned. * respect *RootPaths and *RootPath * * @param string $pathAndFilename e.g. Email/Name.html * @param string $part "template", "partial", "layout" * @return string Filename/path */ public static function getTemplatePath($pathAndFilename, $part = 'template') { $matches = self::getTemplatePaths($pathAndFilename, $part); return !empty($matches) ? end($matches) : ''; } /** * Return path and filename for one or many files/paths. * Only existing files/paths will be returned. * respect *RootPaths and *RootPath * * @param string $pathAndFilename Path/filename (Email/Name.html) or path * @param string $part "template", "partial", "layout" * @return array All existing matches found */ public static function getTemplatePaths($pathAndFilename, $part = 'template') { $pathAndFilenames = []; $absolutePaths = self::getTemplateFolders($part, true); foreach ($absolutePaths as $absolutePath) { if (file_exists($absolutePath . $pathAndFilename)) { $pathAndFilenames[] = $absolutePath . $pathAndFilename; } } return $pathAndFilenames; } /** * Get standaloneview with default properties * * @param string $controllerName * @param string $extensionName * @param string $pluginName * @param string $format * @return StandaloneView */ public static function getDefaultStandAloneView( $controllerName = 'New', $extensionName = 'Femanager', $pluginName = 'Pi1', $format = 'html' ) { /** @var StandaloneView $standAloneView */ $standAloneView = GeneralUtility::makeInstance(StandaloneView::class); $standAloneView->getRequest()->setControllerExtensionName($extensionName); $standAloneView->getRequest()->setPluginName($pluginName); $standAloneView->getRequest()->setControllerName($controllerName); $standAloneView->setFormat($format); $standAloneView->setLayoutRootPaths(TemplateUtility::getTemplateFolders('layout')); $standAloneView->setPartialRootPaths(TemplateUtility::getTemplateFolders('partial')); return $standAloneView; } }