コード例 #1
0
 /**
  * @param array $row
  * @return array
  */
 public function getTemplatePaths(array $row)
 {
     $extensionName = $this->getExtensionKey($row);
     $paths = $this->configurationService->getContentConfiguration($extensionName);
     if (TRUE === is_array($paths) && FALSE === empty($paths)) {
         $paths = PathUtility::translatePath($paths);
         return $paths;
     }
     return parent::getTemplatePaths($row);
 }
コード例 #2
0
ファイル: AbstractProvider.php プロジェクト: busynoggin/flux
 /**
  * @param array $row
  * @return array
  */
 public function getTemplatePaths(array $row)
 {
     $paths = $this->templatePaths;
     if (FALSE === is_array($paths)) {
         $extensionKey = $this->getExtensionKey($row);
         $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionKey);
         if (FALSE === empty($extensionKey)) {
             $paths = $this->configurationService->getViewConfigurationForExtensionName($extensionKey);
         }
     }
     if (TRUE === is_array($paths)) {
         $paths = PathUtility::translatePath($paths);
     }
     return $paths;
 }
コード例 #3
0
 /**
  * @param array $paths
  * @param string $template
  * @return string
  */
 public function expandPathsAndTemplateFileToTemplatePathAndFilename($paths, $template)
 {
     if (TRUE === file_exists($template)) {
         $templatePathAndFilename = $template;
     } else {
         if (TRUE === is_array($paths) && FALSE === empty($paths)) {
             $paths = PathUtility::translatePath($paths);
         }
         $templatePathAndFilename = rtrim($paths['templateRootPath'], '/') . '/Page/' . $template . '.html';
     }
     return $templatePathAndFilename;
 }
コード例 #4
0
 /**
  * @test
  */
 public function canSetTemplatePaths()
 {
     $provider = $this->getConfigurationProviderInstance();
     $record = $this->getBasicRecord();
     $templatePaths = array('templateRootPath' => 'EXT:flux/Resources/Private/Templates');
     $provider->setTemplatePaths($templatePaths);
     $this->assertSame(PathUtility::translatePath($templatePaths), $provider->getTemplatePaths($record));
 }
コード例 #5
0
ファイル: CoreTest.php プロジェクト: samuweiss/TYPO3-Site
 /**
  * @test
  */
 public function canRegisterStandaloneTemplateForTable()
 {
     $service = $this->createFluxServiceInstance();
     $variables = array('test' => 'test');
     $paths = array('templateRootPath' => 'EXT:flux/Resources/Private/Templates');
     $table = 'fake';
     $fieldName = NULL;
     $providerClassName = 'FluidTYPO3\\Flux\\Provider\\ProviderInterface';
     $relativeTemplatePathAndFilename = self::FIXTURE_TEMPLATE_ABSOLUTELYMINIMAL;
     $record = Records::$contentRecordWithoutParentAndWithoutChildren;
     $absoluteTemplatePathAndFilename = GeneralUtility::getFileAbsFileName($relativeTemplatePathAndFilename);
     $configurationSectionName = 'Configuration';
     Core::registerFluidFlexFormTable($table, $fieldName, $relativeTemplatePathAndFilename, $variables, $configurationSectionName, $paths);
     $detectedProvider = $service->resolvePrimaryConfigurationProvider($table, $fieldName, $record);
     $this->assertInstanceOf($providerClassName, $detectedProvider);
     $this->assertSame($absoluteTemplatePathAndFilename, $detectedProvider->getTemplatePathAndFilename($record));
     $this->assertSame(PathUtility::translatePath($paths), $detectedProvider->getTemplatePaths($record));
 }
コード例 #6
0
 /**
  * @return void
  */
 public function initializeObject()
 {
     $typoScript = $this->configurationService->getAllTypoScript();
     $settings = $typoScript['plugin']['tx_fluidcontentcore']['settings'];
     $this->templateVariables['settings'] = $settings;
     $this->templatePathAndFilename = PathUtility::translatePath($settings['defaults']['template']);
 }
コード例 #7
0
 /**
  * @param array $row
  * @return array
  */
 public function getTemplatePaths(array $row)
 {
     $paths = $this->templatePaths;
     $extensionKey = $this->getExtensionKey($row);
     $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionKey);
     if (FALSE === is_array($paths)) {
         $extensionKey = $this->getExtensionKey($row);
         if (FALSE === empty($extensionKey) && TRUE === ExtensionManagementUtility::isLoaded($extensionKey)) {
             $paths = $this->configurationService->getViewConfigurationForExtensionName($extensionKey);
         }
     }
     if (NULL !== $paths && FALSE === is_array($paths)) {
         $this->configurationService->message('Template paths resolved for "' . $extensionKey . '" was not an array.', GeneralUtility::SYSLOG_SEVERITY_WARNING);
         $paths = NULL;
     }
     if (NULL === $paths) {
         $extensionKey = $this->getExtensionKey($row);
         if (FALSE === empty($extensionKey) && TRUE === ExtensionManagementUtility::isLoaded($extensionKey)) {
             $paths = array(ExtensionManagementUtility::extPath($extensionKey, 'Resources/Private/Templates/'), ExtensionManagementUtility::extPath($extensionKey, 'Resources/Private/Partials/'), ExtensionManagementUtility::extPath($extensionKey, 'Resources/Private/Layouts/'));
         } else {
             $paths = array();
         }
     }
     if (TRUE === is_array($paths)) {
         $paths = PathUtility::translatePath($paths);
     }
     return $paths;
 }
コード例 #8
0
 /**
  * Gets an array of TypoScript configuration from below plugin.tx_fed -
  * if $extensionName is set in parameters it is used to indicate which sub-
  * section of the result to return.
  *
  * @param string $extensionName
  * @param string $memberName
  * @param string $containerExtensionScope If TypoScript is not located under plugin.tx_fed, change the tx_<scope> part by specifying this argument
  * @param string $superScope Either "plugin" or "module", depending on the root scope
  * @return array
  */
 public function getTypoScriptSubConfiguration($extensionName, $memberName, $containerExtensionScope = 'fed', $superScope = 'plugin')
 {
     $containerExtensionScope = str_replace('_', '', $containerExtensionScope);
     $cacheKey = $extensionName . $memberName . $containerExtensionScope;
     if (TRUE === isset(self::$cache[$cacheKey])) {
         return self::$cache[$cacheKey];
     }
     $config = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     if (FALSE === isset($config[$superScope . '.']['tx_' . $containerExtensionScope . '.'][$memberName . '.'])) {
         return NULL;
     }
     $config = $config[$superScope . '.']['tx_' . $containerExtensionScope . '.'][$memberName . '.'];
     $config = GeneralUtility::removeDotsFromTS($config);
     if ($extensionName) {
         $config = $config[$extensionName];
     }
     if (FALSE === is_array($config)) {
         $config = array();
     }
     $config = PathUtility::translatePath($config);
     self::$cache[$cacheKey] = $config;
     return $config;
 }
コード例 #9
0
ファイル: TemplatePaths.php プロジェクト: busynoggin/flux
 /**
  * Guarantees that $reference is turned into a
  * correct, absolute path. The input can be a
  * relative path or a FILE: or EXT: reference
  * but cannot be a FAL resource identifier.
  *
  * @param mixed $reference
  * @return mixed
  */
 protected function ensureAbsolutePath($reference)
 {
     return PathUtility::translatePath($reference);
 }
コード例 #10
0
 /**
  * @return Form[][]
  */
 public function getContentElementFormInstances()
 {
     $elements = array();
     $allTemplatePaths = $this->getContentConfiguration();
     foreach ($allTemplatePaths as $key => $templatePathSet) {
         $key = trim($key, '.');
         $extensionKey = TRUE === isset($templatePathSet['extensionKey']) ? $templatePathSet['extensionKey'] : $key;
         $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionKey);
         $paths = array('templateRootPath' => TRUE === isset($templatePathSet['templateRootPath']) ? $templatePathSet['templateRootPath'] : 'EXT:' . $extensionKey . '/Resources/Private/Templates/', 'layoutRootPath' => TRUE === isset($templatePathSet['layoutRootPath']) ? $templatePathSet['layoutRootPath'] : 'EXT:' . $extensionKey . '/Resources/Private/Layouts/', 'partialRootPath' => TRUE === isset($templatePathSet['partialRootPath']) ? $templatePathSet['partialRootPath'] : 'EXT:' . $extensionKey . '/Resources/Private/Partials/');
         $paths = PathUtility::translatePath($paths);
         $templateRootPath = rtrim($paths['templateRootPath'], '/') . '/';
         if (TRUE === file_exists($templateRootPath . 'Content/')) {
             $templateRootPath = $templateRootPath . 'Content/';
         }
         $templateRootPathLength = strlen($templateRootPath);
         $files = array();
         $files = GeneralUtility::getAllFilesAndFoldersInPath($files, $templateRootPath, 'html');
         if (0 < count($files)) {
             foreach ($files as $templateFilename) {
                 $fileRelPath = substr($templateFilename, $templateRootPathLength);
                 $form = $this->getFormFromTemplateFile($templateFilename, 'Configuration', 'form', $paths, $extensionKey);
                 if (TRUE === empty($form)) {
                     $this->sendDisabledContentWarning($templateFilename);
                     continue;
                 }
                 if (FALSE === $form->getEnabled()) {
                     $this->sendDisabledContentWarning($templateFilename);
                     continue;
                 }
                 $id = $extensionKey . '_' . preg_replace('/[\\.\\/]/', '_', $fileRelPath);
                 $form->setOption('contentElementId', $extensionKey . ':' . $fileRelPath);
                 $elements[$extensionKey][$id] = $form;
             }
         }
     }
     return $elements;
 }
コード例 #11
0
 /**
  * Scans all folders in $allTemplatePaths for template
  * files, reads information about each file and collects
  * the groups of files into groups of pageTSconfig setup.
  *
  * @param array $allTemplatePaths
  * @return array
  */
 protected function buildAllWizardTabGroups($allTemplatePaths)
 {
     $wizardTabs = array();
     foreach ($allTemplatePaths as $key => $templatePathSet) {
         $key = trim($key, '.');
         $extensionKey = TRUE === isset($templatePathSet['extensionKey']) ? $templatePathSet['extensionKey'] : $key;
         $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionKey);
         $paths = array('templateRootPath' => TRUE === isset($templatePathSet['templateRootPath']) ? $templatePathSet['templateRootPath'] : 'EXT:' . $extensionKey . '/Resources/Private/Templates/', 'layoutRootPath' => TRUE === isset($templatePathSet['layoutRootPath']) ? $templatePathSet['layoutRootPath'] : 'EXT:' . $extensionKey . '/Resources/Private/Layouts/', 'partialRootPath' => TRUE === isset($templatePathSet['partialRootPath']) ? $templatePathSet['partialRootPath'] : 'EXT:' . $extensionKey . '/Resources/Private/Partials/');
         $paths = PathUtility::translatePath($paths);
         $templateRootPath = $paths['templateRootPath'];
         if ('/' !== substr($templateRootPath, -1)) {
             $templateRootPath .= '/';
         }
         if (TRUE === file_exists($templateRootPath . 'Content/')) {
             $templateRootPath = $templateRootPath . 'Content/';
         }
         $files = array();
         $files = GeneralUtility::getAllFilesAndFoldersInPath($files, $templateRootPath, 'html');
         if (0 < count($files)) {
             foreach ($files as $templateFilename) {
                 $fileRelPath = substr($templateFilename, strlen($templateRootPath));
                 $form = $this->getFormFromTemplateFile($templateFilename, 'Configuration', 'form', $paths, $extensionKey);
                 if (TRUE === empty($form)) {
                     $this->sendDisabledContentWarning($templateFilename);
                     continue;
                 }
                 if (FALSE === $form->getEnabled()) {
                     $this->sendDisabledContentWarning($templateFilename);
                     continue;
                 }
                 $group = $form->getGroup();
                 if (FALSE === empty($group)) {
                     $tabId = $this->sanitizeString($group);
                     $wizardTabs[$tabId]['title'] = $group;
                 } else {
                     $tabId = 'Content';
                 }
                 $id = $extensionKey . '_' . preg_replace('/[\\.\\/]/', '_', $fileRelPath);
                 $elementTsConfig = $this->buildWizardTabItem($tabId, $id, $form, $key . ':' . $fileRelPath);
                 $wizardTabs[$tabId]['elements'][$id] = $elementTsConfig;
                 $wizardTabs[$tabId]['key'] = $extensionKey;
             }
         }
     }
     return $wizardTabs;
 }