public static getRegisteredProviderExtensionKeys ( string $forControllerName ) : array | ||
$forControllerName | string | |
Результат | array |
/** * Gets a collection of path configurations for content elements * based on each root TypoScript template in the provided array * of templates. Returns an array of paths indexed by the root * page UID. * * @param array $templates * @return array */ protected function getPathConfigurationsFromRootTypoScriptTemplates($templates) { $allTemplatePaths = array(); $registeredExtensionKeys = Core::getRegisteredProviderExtensionKeys('Content'); foreach ($templates as $templateRecord) { $pageUid = $templateRecord['pid']; /** @var \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService $template */ $template = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService'); $template->tt_track = 0; $template->init(); /** @var \TYPO3\CMS\Frontend\Page\PageRepository $sys_page */ $sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $rootLine = $sys_page->getRootLine($pageUid); $template->runThroughTemplates($rootLine); $template->generateConfig(); $oldTemplatePathLocation = (array) $template->setup['plugin.']['tx_fed.']['fce.']; $newTemplatePathLocation = (array) $template->setup['plugin.']['tx_fluidcontent.']['collections.']; $registeredPathCollections = array(); foreach ($registeredExtensionKeys as $registeredExtensionKey) { $nativeViewLocation = $this->getContentConfiguration($registeredExtensionKey); if (FALSE === isset($nativeViewLocation['extensionKey'])) { $nativeViewLocation['extensionKey'] = ExtensionNamingUtility::getExtensionKey($registeredExtensionKey); } $registeredPathCollections[$registeredExtensionKey] = $nativeViewLocation; } $merged = GeneralUtility::array_merge_recursive_overrule($oldTemplatePathLocation, $newTemplatePathLocation); $merged = GeneralUtility::removeDotsFromTS($merged); $merged = GeneralUtility::array_merge($merged, $registeredPathCollections); $allTemplatePaths[$pageUid] = $merged; } return $allTemplatePaths; }
/** * @test */ public function canRegisterProviderExtensionKey() { $fakeExtensionKey = 'flux'; $fakeControllerName = 'Flux'; Core::registerProviderExtensionKey($fakeExtensionKey, $fakeControllerName); $registered = Core::getRegisteredProviderExtensionKeys($fakeControllerName); $this->assertContains($fakeExtensionKey, $registered); }
/** * Get definitions of paths for Page Templates defined in TypoScript * * @param string $extensionName * @return array * @api */ public function getPageConfiguration($extensionName = null) { if (null !== $extensionName && true === empty($extensionName)) { // Note: a NULL extensionName means "fetch ALL defined collections" whereas // an empty value that is not null indicates an incorrect caller. Instead // of returning ALL paths here, an empty array is the proper return value. // However, dispatch a debug message to inform integrators of the problem. $this->message('Template paths have been attempted fetched using an empty value that is NOT NULL in ' . get_class($this) . '. This indicates a potential problem with your TypoScript configuration - a ' . 'value which is expected to be an array may be defined as a string. This error is not fatal but may ' . 'prevent the affected collection (which cannot be identified here) from showing up', GeneralUtility::SYSLOG_SEVERITY_NOTICE); return []; } if (null !== $extensionName) { return $this->getViewConfigurationForExtensionName($extensionName); } $configurations = []; $registeredExtensionKeys = Core::getRegisteredProviderExtensionKeys('Page'); foreach ($registeredExtensionKeys as $registeredExtensionKey) { $configurations[$registeredExtensionKey] = $this->getViewConfigurationForExtensionName($registeredExtensionKey); } return $configurations; }
/** * Get definitions of paths for FCEs defined in TypoScript * * @param string $extensionName * @return array * @api */ public function getContentConfiguration($extensionName = NULL) { if (NULL !== $extensionName) { return $this->getViewConfigurationForExtensionName($extensionName); } $registeredExtensionKeys = (array) Core::getRegisteredProviderExtensionKeys('Content'); $configuration = array(); foreach ($registeredExtensionKeys as $registeredExtensionKey) { $configuration[$registeredExtensionKey] = $this->getContentConfiguration($registeredExtensionKey); } return $configuration; }
/** * @return void */ protected function performDummyRegistration() { Core::registerProviderExtensionKey($this->extensionName, $this->getControllerName()); $this->assertContains($this->extensionName, Core::getRegisteredProviderExtensionKeys($this->getControllerName())); }
/** * @return array */ protected function getRegisteredProviderExtensionKeys() { return Core::getRegisteredProviderExtensionKeys('Backend'); }
/** * Get definitions of paths for Page Templates defined in TypoScript * * @param string $extensionName * @return array * @api */ public function getPageConfiguration($extensionName = NULL) { $cacheKey = NULL === $extensionName ? 'pages_global' : 'pages_' . $extensionName; if (TRUE === isset(self::$cache[$cacheKey])) { return self::$cache[$cacheKey]; } if (NULL !== $extensionName && TRUE === empty($extensionName)) { // Note: a NULL extensionName means "fetch ALL defined collections" whereas // an empty value that is not null indicates an incorrect caller. Instead // of returning ALL paths here, an empty array is the proper return value. // However, dispatch a debug message to inform integrators of the problem. $this->message('Template paths have been attempted fetched using an empty value that is NOT NULL in ' . get_class($this) . '. This indicates a potential problem with your TypoScript configuration - a value which is expected to be ' . 'an array may be defined as a string. This error is not fatal but may prevent the affected collection (which cannot ' . 'be identified here) from showing up', GeneralUtility::SYSLOG_SEVERITY_NOTICE); return array(); } if (TYPO3_MODE === 'BE') { // Hack. This is no fun matter, but the TYPO3 BackendConfigurationManager // is incapable of considering how to fetch a page UID from the "editconf" // array which is used when editing a particular page. The result is that // because Flux uses Extbase's resolve methods for TypoScript, the methods // will use the fallback behavior (only root TS templates). Forcibly setting // this GET['id'] should not have a negative effect on other scripts and will // fix the problem - because Extbase will instantly detect and use this ID. // New behaviour has one flaw: editing multiple pages will cause every page // to use the first page's TypoScript settings and therefore page templates - // which could be a problem when editing multiple pages each having own TS. if (TRUE === isset($GLOBALS['SOBE']->editconf['pages'])) { $_GET['id'] = key($GLOBALS['SOBE']->editconf['pages']); } } $newLocation = (array) $this->getTypoScriptSubConfiguration($extensionName, 'collections', 'fluidpages'); $oldLocation = (array) $this->getTypoScriptSubConfiguration($extensionName, 'page', 'fed'); $merged = (array) GeneralUtility::array_merge_recursive_overrule($oldLocation, $newLocation); if (NULL === $extensionName) { $registeredExtensionKeys = Core::getRegisteredProviderExtensionKeys('Page'); foreach ($registeredExtensionKeys as $registeredExtensionKey) { $extensionViewPaths = $this->getPageConfiguration($registeredExtensionKey); if (FALSE === isset($extensionViewPaths['extensionKey'])) { $extensionViewPaths['extensionKey'] = ExtensionNamingUtility::getExtensionKey($registeredExtensionKey); } // preemptive caching; once read here, the cached value is returned when asking for specific extensions later if (FALSE === isset($extensionViewPaths['templateRootPath'])) { $this->sendWarningAboutMissingTemplatePath($registeredExtensionKey); continue; } self::$cache[$registeredExtensionKey] = $extensionViewPaths; $merged[$registeredExtensionKey] = $extensionViewPaths; } } else { $nativeViewLocation = $this->getViewConfigurationForExtensionName($extensionName); if (TRUE === is_array($nativeViewLocation)) { $merged = GeneralUtility::array_merge_recursive_overrule($nativeViewLocation, $merged); } if (FALSE === isset($nativeViewLocation['extensionKey'])) { $merged['extensionKey'] = ExtensionNamingUtility::getExtensionKey($extensionName); } if (FALSE === isset($merged['templateRootPath'])) { $this->sendWarningAboutMissingTemplatePath($extensionName); } } self::$cache[$cacheKey] = $merged; return $merged; }