diff --git a/ChangeLog.md b/ChangeLog.md index 1307e06a..a7bac26a 100755 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,8 +1,16 @@ # Themes Change-Log +## 2018-07-?? Release of version 8.7.2 + +### 2018-07-13 Thomas Deuling + +* [BUGFIX] Fixing adding page TypoScript for Theme features and extensions. + + + ## 2018-07-11 Release of version 8.7.2 -### 2018-06-11 Thomas Deuling +### 2018-07-11 Thomas Deuling * [FEATURE] Adding new feature for selecting Theme features/extensions in order minimize loaded configuration by using the Theme. More information in Documentation/ExtensionsAndFeaturesInThemes.rst. diff --git a/Classes/Slots/BackendUtilitySlot.php b/Classes/Slots/BackendUtilitySlot.php index 61689e2e..385adafe 100755 --- a/Classes/Slots/BackendUtilitySlot.php +++ b/Classes/Slots/BackendUtilitySlot.php @@ -2,10 +2,15 @@ namespace KayStrobach\Themes\Slots; +use KayStrobach\Themes\Domain\Model\Theme; +use KayStrobach\Themes\Domain\Repository\ThemeRepository; +use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Backend\Configuration\TsConfigParser; +use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Utility\DebuggerUtility; /** * This class automatically adds the theme TSConfig for the current page @@ -89,22 +94,28 @@ public function getPagesTsConfigPreInclude($typoscriptDataArray, $pageUid, $root * @param $pageUid */ protected function fetchThemeExtensionsAndFeatures($pageUid) { - /** @var \TYPO3\CMS\Core\Database\Query\QueryBuilder $queryBuilder */ - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) - ->getQueryBuilderForTable('sys_template'); - $queryBuilder->select('*') - ->from('sys_template') - ->where( - $queryBuilder->expr()->eq( - 'pid', $queryBuilder->createNamedParameter((int)$pageUid, \PDO::PARAM_INT) - ) - ); - /** @var \Doctrine\DBAL\Driver\Statement $statement */ - $statement = $queryBuilder->execute(); - if ($statement->rowCount()>0) { - $tRow = $statement->fetch(); - $this->themeExtensions = GeneralUtility::trimExplode(',', $tRow['tx_themes_extensions'], true); - $this->themeFeatures = GeneralUtility::trimExplode(',', $tRow['tx_themes_features'], true); + // + // Find sys_template recursive + $rootline = BackendUtility::BEgetRootLine($pageUid); + foreach ($rootline as $page) { + /** @var \TYPO3\CMS\Core\Database\Query\QueryBuilder $queryBuilder */ + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) + ->getQueryBuilderForTable('sys_template'); + $queryBuilder->select('*') + ->from('sys_template') + ->where( + $queryBuilder->expr()->eq( + 'pid', $queryBuilder->createNamedParameter((int)$page['uid'], \PDO::PARAM_INT) + ) + ); + /** @var \Doctrine\DBAL\Driver\Statement $statement */ + $statement = $queryBuilder->execute(); + if ($statement->rowCount()>0) { + $tRow = $statement->fetch(); + $this->themeExtensions = GeneralUtility::trimExplode(',', $tRow['tx_themes_extensions'], true); + $this->themeFeatures = GeneralUtility::trimExplode(',', $tRow['tx_themes_features'], true); + break; + } } }