Skip to content

Commit

Permalink
Merge pull request #75 from t3solution/4.5.4
Browse files Browse the repository at this point in the history
v4.5.4
  • Loading branch information
t3solution authored Nov 28, 2020
2 parents 9996405 + 7b31832 commit 7c0de63
Show file tree
Hide file tree
Showing 50 changed files with 798 additions and 413 deletions.
6 changes: 3 additions & 3 deletions Classes/Command/CdnToLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ protected function execute(InputInterface $input, OutputInterface $output)

if ($settings['cdn']['bootswatch']) {
$bootswatchTheme = $settings['cdn']['bootswatch'];
$cdnPath = 'https://stackpath.bootstrapcdn.com/bootswatch/'.$settings['cdn']['bootstrap'].'/'.$bootswatchTheme.'/bootstrap.min.css';
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootswatch@'.$settings['cdn']['bootstrap'].'/dist/'.$bootswatchTheme.'/bootstrap.min.css';
self::writeCustomFile($customPath, $customFileName, $cdnPath, true);
} else {
$cdnPath = 'https://stackpath.bootstrapcdn.com/bootstrap/'.$settings['cdn']['bootstrap'].'/css/bootstrap.min.css';
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootstrap@'.$settings['cdn']['bootstrap'].'/dist/css/bootstrap.min.css';
self::writeCustomFile($customPath, $customFileName, $cdnPath, true);
}

$customDir = 'fileadmin/T3SB/Resources/Public/JS/';
$customPath = GeneralUtility::getFileAbsFileName($customDir);
$customFileName = 'bootstrap.min.js';
$cdnPath = 'https://stackpath.bootstrapcdn.com/bootstrap/'.$version.'/js/bootstrap.min.js';
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootstrap@'.$version.'/dist/js/bootstrap.min.js';
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

Expand Down
243 changes: 235 additions & 8 deletions Classes/Controller/ConfigController.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Classes/DataProcessing/BootstrapProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
##############################################################################################################################################

// container class
$processedData['data']['configuid'] = $cObj->stdWrapValue('configuid',$processorConfiguration,'');
$processedData['data']['configuid'] = (int)$processorConfiguration['configuid'];
$container = $defaultHelper->getContainerClass($processedData['data']);
if ($container && $container != 'colPosContainer') {
$processedData['containerPre'] = '<div class="'.$container.'">';
Expand Down
72 changes: 11 additions & 61 deletions Classes/DataProcessing/ConfigProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\RootlineUtility;
use TYPO3\CMS\Core\Site\Entity\SiteInterface;
use TYPO3\CMS\Core\Routing\SiteMatcher;
use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor;
Expand Down Expand Up @@ -96,60 +95,21 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$frontendController = self::getFrontendController();
$webp = $this->processorConfiguration['webp'];

// the table to query
$tableName = 'tx_t3sbootstrap_domain_model_config';
$this->processorConfiguration['pidInList'] = $frontendController->id;
if ( is_numeric($this->contentObjectConfiguration['settings.']['db.']['uid']) ) {

// execute a SQL statement to fetch the records from current page
$records = $this->contentObjectRenderer->getRecords($tableName, $this->processorConfiguration);
$processedRecordVariables = $this->contentObjectConfiguration['settings.']['db.'];

$rootLineArray = GeneralUtility::makeInstance(RootlineUtility::class, (int)$this->processedData['data']['uid'])->get();

if ( empty($records) ) {

if ( $this->processorConfiguration['rootline'] ) {
// config from rootline
// unset current page
$rlA = $rootLineArray;
unset($rlA[count($rlA)-1]);

foreach ($rlA as $rootline) {
$this->processorConfiguration['pidInList'] = $rootline['uid'];
$records = $this->contentObjectRenderer->getRecords($tableName, $this->processorConfiguration);

if ( !empty($records) ) break;
}
} else {
// config from root page
if ( $this->processedData['data']['is_siteroot'] ) {
$rootPageUid = $this->processedData['data']['uid'];
} else {
$rootPageUid = $rootLineArray[0]['uid'];
}
$this->processorConfiguration['pidInList'] = $rootPageUid;
$records = $this->contentObjectRenderer->getRecords($tableName, $this->processorConfiguration);
}
}

if ( empty($records) ) {

$this->processedData['noConfig'] = TRUE;

return $this->processedData;
} else {

} else {
$this->processedData['noConfig'] = TRUE;

$this->contentObjectRenderer->start($records[0], $tableName);
$processedRecordVariables = $this->contentDataProcessor->process($this->contentObjectRenderer, $this->processorConfiguration, $records[0]);
return $this->processedData;
}

// override config by TS
if ( $this->contentObjectConfiguration['settings.']['configOverride'] ) {
foreach ( $this->contentObjectConfiguration['settings.']['override.'] as $key=>$override ) {


if ( ($override || $override === '0' || $override === 'false') && $override[1] != '$' ) {

if ( $override === 'none' ) {
$processedRecordVariables[$key] = '';
} else {
Expand All @@ -159,7 +119,6 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
}
}

#\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($processedRecordVariables, '$processedRecordVariables');

/**
* General
Expand Down Expand Up @@ -192,8 +151,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
}

$rootlinePage = $pageRepository->getPage($frontendController->rootLine[0]['uid']);

$rootlinePage = $pageRepository->getPage($processedRecordVariables['uid']);
$smallColumnsRootline = (int)$rootlinePage['tx_t3sbootstrap_smallColumns'];
$smallColumns = $smallColumnsCurrent ?: $smallColumnsRootline;

Expand All @@ -211,7 +169,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$threeCol = $currentPage['backend_layout'] == 'pagets__ThreeCol' ? TRUE : FALSE;
} else {

foreach ($rootLineArray as $subPage) {
foreach ($frontendController->rootLine as $subPage) {
$bel = $subPage['backend_layout_next_level'];
if ( !empty($subPage['backend_layout_next_level']) ) break;
}
Expand All @@ -238,11 +196,6 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$this->processedData['colMain'] = 9;
}

// image from pages media
if ( $processedRecordVariables['pagemedia'] ) {
$this->processedData['pagemedia'] = $processedRecordVariables['pagemedia'];
}

// grid breakpoint
$this->processedData['gridBreakpoint'] = $currentPage['tx_t3sbootstrap_breakpoint'] ?: 'md';

Expand Down Expand Up @@ -312,7 +265,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$this->processedData['config']['navbar']['enable'] = $processedRecordVariables['navbar_enable'];
$this->processedData['config']['navbar']['sectionMenu'] = $processedRecordVariables['navbar_sectionmenu'] ? ' section-menu' : '';
$this->processedData['config']['navbar']['brand'] = $processedRecordVariables['navbar_brand'];
if ( $rootLineArray[1]['doktype'] == 4) {
if ( $frontendController->rootLine[1]['doktype'] == 4) {
$this->processedData['config']['navbar']['clickableparent'] = 1;
} else {
$this->processedData['config']['navbar']['clickableparent'] = $processedRecordVariables['navbar_clickableparent'];
Expand Down Expand Up @@ -412,7 +365,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu

if ( $processedRecordVariables['jumbotron_bgimage'] == 'root' ) {
// slide in rootline
foreach ($rootLineArray as $page) {
foreach ($frontendController->rootLine as $page) {
$fileObjects = $fileRepository->findByRelation('pages', 'media', $page['uid']);
$uid = $page['uid'];
if ($fileObjects) break;
Expand Down Expand Up @@ -447,7 +400,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
if ( $this->contentObjectConfiguration['settings.']['backgroundImageEnable'] ) {
$bgImage = $this->getBackgroundImageUtility()->getBgImage($frontendController->id, 'pages', FALSE, FALSE, [], TRUE, 0, $webp);
if ( empty($bgImage) && $this->contentObjectConfiguration['settings.']['backgroundImageSlide'] ) {
foreach ($rootLineArray as $page) {
foreach ($frontendController->rootLine as $page) {
$bgImage = $this->getBackgroundImageUtility()->getBgImage($page['uid'], 'pages', FALSE, FALSE, [], TRUE, $frontendController->id, $webp);
if ($bgImage) break;
}
Expand Down Expand Up @@ -501,7 +454,6 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$footerClass .= $processedRecordVariables['footer_fluid'] ? ' jumbotron-fluid' : '';
$footerClass .= $processedRecordVariables['footer_sticky'] ? ' footer-sticky' : '';
$this->processedData['config']['footer']['class'] = trim($footerClass);

}

/**
Expand All @@ -520,7 +472,6 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$this->processedData['config']['expandedcontentBottom']['container'] = $processedRecordVariables['expandedcontent_containerbottom'];
$this->processedData['config']['expandedcontentBottom']['containerposition'] = $processedRecordVariables['expandedcontent_containerpositionbottom'];
$this->processedData['config']['expandedcontentBottom']['class'] = $processedRecordVariables['expandedcontent_classbottom'];

}

if (!$this->processorConfiguration['disableDefaultCss']) {
Expand Down Expand Up @@ -694,6 +645,7 @@ private function includeRequiredFiles($processedRecordVariables, $webp) {
self::writeCustomFile($customPath, $customFileName, $js);
}


// include required files to fileadmin
if ($css) {
$projectCSS = GeneralUtility::makeInstance(FilePathSanitizer::class)->sanitize(
Expand Down Expand Up @@ -734,7 +686,6 @@ private function writeCustomFile($customPath, $customFileName, $customContent )
$contentLength = strlen(trim($customContent));

if ($customFileLength != $contentLength) {

unlink($customFile);
GeneralUtility::writeFile($customFile, trim($customContent));
}
Expand All @@ -752,5 +703,4 @@ private function writeCustomFile($customPath, $customFileName, $customContent )
}



}
3 changes: 2 additions & 1 deletion Classes/DataProcessing/GalleryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,8 @@ protected function getPageContainer($pageContainer)
|| ($this->colPos === -1 && $this->processedData['data']['parentgrid_tx_gridelements_backend_layout'] == 'background_wrapper')
)
{
$t3sbconfig = self::getContentRecord($this->getConfigurationValue('configuid'), 'tx_t3sbootstrap_domain_model_config');

$t3sbconfig = self::getContentRecord((int)$this->getConfigurationValue('configuid'), 'tx_t3sbootstrap_domain_model_config');

$jumbotronContainer = $t3sbconfig[0]['jumbotron_container'];
$footerContainer = $t3sbconfig[0]['footer_container'];
Expand Down
48 changes: 44 additions & 4 deletions Classes/Domain/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ class Config extends AbstractEntity
protected $navbarBackground = '';



/**
* navbarShrinkcolorschemes
*
Expand Down Expand Up @@ -578,6 +577,15 @@ class Config extends AbstractEntity
*/
protected $expandedcontentClassbottom = '';


/**
* generalRootline
*
* @var bool
*/
protected $generalRootline = false;


/**
* Returns the pid
*
Expand Down Expand Up @@ -2375,7 +2383,7 @@ public function setExpandedcontentClasstop($expandedcontentClasstop)
*
* @return bool $expandedcontentEnablebottom
*/
public function getexpandedcontentEnablebottom()
public function getExpandedcontentEnablebottom()
{
return $this->expandedcontentEnablebottom;
}
Expand All @@ -2386,7 +2394,7 @@ public function getexpandedcontentEnablebottom()
* @param bool $expandedcontentEnablebottom
* @return void
*/
public function setexpandedcontentEnablebottom($expandedcontentEnablebottom)
public function setExpandedcontentEnablebottom($expandedcontentEnablebottom)
{
$this->expandedcontentEnablebottom = $expandedcontentEnablebottom;
}
Expand All @@ -2396,7 +2404,7 @@ public function setexpandedcontentEnablebottom($expandedcontentEnablebottom)
*
* @return bool
*/
public function isexpandedcontentEnablebottom()
public function isExpandedcontentEnablebottom()
{
return $this->expandedcontentEnablebottom;
}
Expand Down Expand Up @@ -2495,4 +2503,36 @@ public function setExpandedcontentClassbottom($expandedcontentClassbottom)
$this->expandedcontentClassbottom = $expandedcontentClassbottom;
}

/**
* Returns the generalRootline
*
* @return bool $generalRootline
*/
public function getGeneralRootline()
{
return $this->generalRootline;
}

/**
* Sets the generalRootline
*
* @param bool $generalRootline
* @return void
*/
public function setGeneralRootline($generalRootline)
{
$this->generalRootline = $generalRootline;
}

/**
* Returns the boolean state of generalRootline
*
* @return bool
*/
public function isGeneralRootline()
{
return $this->generalRootline;
}


}
14 changes: 7 additions & 7 deletions Classes/ExpressionLanguage/T3sbConditionFunctionsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function getFunctions(): array
];
}


protected function getExtconf(): ExpressionFunction
{
return new ExpressionFunction('t3sbootstrap', function ($str) {
Expand Down Expand Up @@ -66,7 +66,7 @@ protected function getBrowser(): ExpressionFunction
return $str === $browser;
});

}
}


protected function getColPosList(): ExpressionFunction
Expand All @@ -76,9 +76,9 @@ protected function getColPosList(): ExpressionFunction
}, function ($arguments, $str) {

$result = FALSE;

if ( $_GET['id'] && TYPO3_MODE == 'BE' ) {

$pid = (int)$_GET['id'];
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$configRepository = $objectManager->get(ConfigRepository::class);
Expand Down Expand Up @@ -157,7 +157,7 @@ protected function getColPosList(): ExpressionFunction
$result = TRUE;
}
}

if ( $config->getExpandedcontentEnabletop() && $config->getExpandedcontentEnablebottom() ) {
if ($str == 'FooterandTopBottom') {
$result = TRUE;
Expand Down Expand Up @@ -185,7 +185,7 @@ protected function getColPosList(): ExpressionFunction
}
}
}
}
}
}

return $result;
Expand All @@ -199,10 +199,10 @@ protected function getExtensionLoaded(): ExpressionFunction
return new ExpressionFunction('loaded', function () {
// Not implemented, we only use the evaluator
}, function ($arguments, $extKey) {

return ExtensionManagementUtility::isLoaded($extKey);
});
}



}
6 changes: 3 additions & 3 deletions Classes/Tasks/CdnToLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ public function execute() {

if ($settings['cdn']['bootswatch']) {
$bootswatchTheme = $settings['cdn']['bootswatch'];
$cdnPath = 'https://stackpath.bootstrapcdn.com/bootswatch/'.$settings['cdn']['bootstrap'].'/'.$bootswatchTheme.'/bootstrap.min.css';
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootswatch@'.$settings['cdn']['bootstrap'].'/dist/'.$bootswatchTheme.'/bootstrap.min.css';
self::writeCustomFile($customPath, $customFileName, $cdnPath, true);
} else {
$cdnPath = 'https://stackpath.bootstrapcdn.com/bootstrap/'.$settings['cdn']['bootstrap'].'/css/bootstrap.min.css';
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootstrap@'.$settings['cdn']['bootstrap'].'/dist/css/bootstrap.min.css';
self::writeCustomFile($customPath, $customFileName, $cdnPath, true);
}

$customDir = 'fileadmin/T3SB/Resources/Public/JS/';
$customPath = GeneralUtility::getFileAbsFileName($customDir);
$customFileName = 'bootstrap.min.js';
$cdnPath = 'https://stackpath.bootstrapcdn.com/bootstrap/'.$version.'/js/bootstrap.min.js';
$cdnPath = 'https://cdn.jsdelivr.net/npm/bootstrap@'.$version.'/dist/js/bootstrap.min.js';
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

Expand Down
2 changes: 0 additions & 2 deletions Classes/Utility/BackgroundImageUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ public function getBgImage($uid, $table='tt_content', $jumbotron=FALSE, $bgColor
if (!empty($filesFromRepository) ) {
$file = $filesFromRepository[0];
$image = $this->imageService()->getImage($file->getOriginalFile()->getUid(), $file->getOriginalFile(), 1);

$uid = $currentUid ?: $uid;

if ( $flexconf['bgimagePosition'] ) {
$uid = $uid . '-' . $flexconf['bgimagePosition'];
}
Expand Down
Loading

0 comments on commit 7c0de63

Please sign in to comment.