Skip to content

Commit

Permalink
[BUGFIX] Fixing adding page TypoScript for Theme features and extensi…
Browse files Browse the repository at this point in the history
…ons.
  • Loading branch information
tdeuling committed Jul 13, 2018
1 parent e193531 commit e3769fa
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
10 changes: 9 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# Themes Change-Log

## 2018-07-?? Release of version 8.7.2

### 2018-07-13 Thomas Deuling <typo3@coding.ms>

* [BUGFIX] Fixing adding page TypoScript for Theme features and extensions.



## 2018-07-11 Release of version 8.7.2

### 2018-06-11 Thomas Deuling <typo3@coding.ms>
### 2018-07-11 Thomas Deuling <typo3@coding.ms>

* [FEATURE] Adding new feature for selecting Theme features/extensions in order minimize loaded configuration by using the Theme. More information in Documentation/ExtensionsAndFeaturesInThemes.rst.

Expand Down
43 changes: 27 additions & 16 deletions Classes/Slots/BackendUtilitySlot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit e3769fa

Please sign in to comment.