Skip to content

Commit

Permalink
Merge pull request #182 from t3solution/5.1.8
Browse files Browse the repository at this point in the history
New release v5.1.8
  • Loading branch information
t3solution authored Feb 12, 2022
2 parents 31b1a0a + 5f0920f commit 06f6a44
Show file tree
Hide file tree
Showing 33 changed files with 186 additions and 140 deletions.
2 changes: 2 additions & 0 deletions Classes/Command/CdnToLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
class CdnToLocal extends Command
{

protected $configurationManager;

public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager)
{
$this->configurationManager = $configurationManager;
Expand Down
7 changes: 3 additions & 4 deletions Classes/Command/CustomScss.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,23 +270,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
private function writeCustomFile($customPath, $customFileName, $settings, $name) {

$customFile = $customPath.$customFileName;
$keepVariables = (int)$settings['keepVariables'];

if (file_exists($customFile)) {
$copyFile = $customPath.'_'.time().'-'.$customFileName;
if (!copy($customFile, $copyFile)) {
return FALSE;
} else {
} elseif ($keepVariables === 0) {
unlink($customFile);
}
}

if (!file_exists($customFile)) {
if (!file_exists($customFile) && $keepVariables === 0) {
if (!is_dir($customPath)) {
mkdir($customPath, 0777, true);
}

$customContent = $name == '_variables' ? '// Overrides Bootstrap variables'.PHP_EOL.'// $enable-shadows: true;'.PHP_EOL.'// $enable-gradients: true;'.PHP_EOL.'// $enable-negative-margins: true;' : '// Your own SCSS';

if ( $settings['bootswatch'] ) {
$customContent = file_get_contents($settings['bootswatchURL'].strtolower($settings['bootswatch']).'/'.$name.'.scss');
if ($name == '_variables') {
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public function constantsAction(): void
if ( $this->isSiteroot ) {
$constantPath = GeneralUtility::getFileAbsFileName('fileadmin/T3SB/Configuration/TypoScript/t3sbconstants.typoscript');
if ( file_exists($constantPath) ) {
$fileGetContents = file_get_contents(GeneralUtility::getFileAbsFileName($constantPath));
$fileGetContents = file_get_contents($constantPath);
$outsourcedConstantsArr = explode('[END]', trim($fileGetContents));
$toEnd = count($outsourcedConstantsArr);
$filecontent = '';
Expand Down
6 changes: 3 additions & 3 deletions Classes/DataProcessing/BootstrapProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$processedData['style'] = $styleHelper->getBgColor($processedData['data']);

// all tx_container
if ( str_contains(self::TX_CONTAINER_GRID.','.self::TX_CONTAINER, $cType) ) {
if ( str_contains(self::TX_CONTAINER_GRID.','.self::TX_CONTAINER, $cType) && $cType !== 'list' ) {

// tx_container - Grid system only
if ( str_contains(self::TX_CONTAINER_GRID, $cType) && $cType !== 'list' ) {
if ( str_contains(self::TX_CONTAINER_GRID, $cType) ) {
$ContainerGridHelper = GeneralUtility::makeInstance(ContainerGridHelper::class);
$processedData = $ContainerGridHelper->getProcessedData($processedData, $flexconf, (bool)$contentObjectConfiguration['settings.']['webp']);
}

// tx_container - NO Grid system
if ( str_contains(self::TX_CONTAINER, $cType) && $cType !== 'list' ) {
if ( str_contains(self::TX_CONTAINER, $cType) ) {
$containerHelper = GeneralUtility::makeInstance(ContainerHelper::class);

$processedData = $containerHelper->getProcessedData($processedData, $flexconf, $parentflexconf, (bool)$contentObjectConfiguration['settings.']['webp'],
Expand Down
29 changes: 14 additions & 15 deletions Classes/DataProcessing/ConfigProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,21 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
/**
* Language Navigation
*/
$site = self::getCurrentSite();
$langUid = [];

foreach ($site->getLanguages() as $lang ) {
$langUid[$lang->getLanguageId()] = $lang->getLanguageId();
$langTitle[$lang->getLanguageId()] = $lang->getNavigationTitle();
$langHref[$lang->getLanguageId()] = $lang->getHreflang();
$langFlag[$lang->getLanguageId()] = $lang->getFlagIdentifier();
if( $processedRecordVariables['navbarEnable'] && $processedRecordVariables['navbarLangmenu'] ) {
$site = self::getCurrentSite();
$langUid = [];
foreach ($site->getLanguages() as $lang ) {
$langUid[$lang->getLanguageId()] = $lang->getLanguageId();
$langTitle[$lang->getLanguageId()] = $lang->getNavigationTitle();
$langHref[$lang->getLanguageId()] = $lang->getHreflang();
$langFlag[$lang->getLanguageId()] = $lang->getFlagIdentifier();
}
$processedData['config']['lang']['uid'] = $langUid ?: '';
$processedData['config']['lang']['hreflang'] = $langHref ?: '';
$processedData['config']['lang']['title'] = $langTitle ?: '';
$processedData['config']['lang']['flag'] = $langFlag ?: '';
}

$processedData['config']['lang']['uid'] = $langUid ?: '';
$processedData['config']['lang']['hreflang'] = $langHref ?: '';
$processedData['config']['lang']['title'] = $langTitle ?: '';
$processedData['config']['lang']['flag'] = $langFlag ?: '';

/**
* Meta Navigation
*/
Expand Down Expand Up @@ -364,7 +364,6 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu

$processedData['config']['jumbotron']['alignItem'] = 'd-flex align-items-'.$processedRecordVariables['jumbotronAlignitem'];
$processedData['config']['jumbotron']['alignment'] = $processedRecordVariables['jumbotronAlignitem'];

if ( $processedRecordVariables['jumbotronBgimage'] == 'root' ) {
// slide in rootline
foreach ($frontendController->rootLine as $page) {
Expand All @@ -384,7 +383,6 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$processedData['data']['uid'], $webp, $contentObjectConfiguration['settings.']['bgMediaQueries']);
$processedData['config']['jumbotron']['bgImage'] = $bgSlides;
}

} elseif ( $processedRecordVariables['jumbotronBgimage'] == 'page' ) {
$fileObjects = $fileRepository->findByRelation('pages', 'media', $frontendController->id);
if ( count($fileObjects) > 1 ) {
Expand Down Expand Up @@ -423,6 +421,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
*/
$processedData['config']['breadcrumb']['class'] = '';
if ( $processedRecordVariables['breadcrumbEnable'] || $processedRecordVariables['breadcrumbBottom'] ) {

if ( ($processedRecordVariables['homepageUid'] == $frontendController->id) && $processedRecordVariables['breadcrumbNotonrootpage'] ) {
$processedData['config']['breadcrumb']['enable'] = FALSE;
$processedData['config']['breadcrumb']['bottom'] = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion Classes/DataProcessing/GalleryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ protected function getPageContainer($pageContainer)
|| $this->colPos == 4
|| $this->colPos == 20
|| $this->colPos == 21
|| $this->colPos > 199 && $this->processedParentData['colPos'] > 2
|| ($this->colPos > 199 && $this->processedParentData['colPos'] > 2)
|| ($this->colPos > 199 && $this->processedData['data']['CType'] == 'background_wrapper')
)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
Expand Down Expand Up @@ -84,8 +83,7 @@ protected function getColPosList(): ExpressionFunction
if ( $_GET['id'] ?? 0 && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend() ) {

$pid = (int)$_GET['id'];
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$configRepository = $objectManager->get(ConfigRepository::class);
$configRepository = GeneralUtility::makeInstance(ConfigRepository::class);
$config = $configRepository->findOneByPid($pid);

if ( empty($config) ) {
Expand Down
18 changes: 11 additions & 7 deletions Classes/Helper/ContainerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getProcessedData(array $processedData, array $flexconf, array $p
$processedData['class'] .= !empty($flexconf['rotate']) ? ' rotateFixedPosition rotate-'.$flexconf['rotate'] : '';
$processedData['class'] .= !empty($flexconf['vertical']) ? ' rotateFixedPosition rotate-'.$flexconf['rotate'] : '';
$processedData['fixedButton'] = TRUE;
if ( $flexconf['slideIn'] && $flexconf['vertical'] && $flexconf['fixedPosition'] == 'right' ) {
if ( !empty($flexconf['slideIn']) && !empty($flexconf['vertical']) && $flexconf['fixedPosition'] == 'right' ) {
$processedData['class'] .= ' slideInButton';
$processedData['visiblePart'] = $flexconf['visiblePart'] ? (int)$flexconf['visiblePart'] : 33;
}
Expand All @@ -74,12 +74,16 @@ public function getProcessedData(array $processedData, array $flexconf, array $p
} else {
$processedData['controlStyle'] = ' pointer-events:none;';
}

if ( !empty($processedData['videoId']) ) {
if ( !empty($processedData['videoId']) && $processedData['youtube'] ) {
$params = '?autoplay='.$processedData['videoAutoPlay'].'&loop='.$flexconf['videoLoop'].'&playlist='.
$processedData['videoId'].'&mute='.$mute.'&rel=0&showinfo=0&controls='.$flexconf['videoControls'].'&modestbranding='.$flexconf['videoControls'];
$processedData['youtubeParams'] = $params;
}
if ( !empty($processedData['videoId']) && $processedData['vimeo'] ) {
$background = !empty($processedData['videoAutoPlay']) ? '&background=1' : '';
$processedData['vimeoParams'] = $background.'&autoplay='.$processedData['videoAutoPlay'].'&loop='.$flexconf['videoLoop'].'&mute='.$mute;
$processedData['startButton'] = $processedData['videoAutoPlay'] ? 0 : 1;
}
}

/**
Expand Down Expand Up @@ -215,10 +219,10 @@ public function getProcessedData(array $processedData, array $flexconf, array $p
$processedData['pill']['asideWidth'] = (int)$flexconf['aside_width'];
$processedData['pill']['mainWidth'] = $flexconf['aside_width'] ? 12 - (int)$flexconf['aside_width'] : 9;
}
$processedData['tab']['displayType'] = $flexconf['display_type'];
$processedData['tab']['switchEffect'] = $parentflexconf['switch_effect'];
$processedData['tab']['contentByPid'] = $flexconf['contentByPid'];
$processedData['tab']['fill'] = $flexconf['fill'] ? ' '.$flexconf['fill']: '';
$processedData['tab']['displayType'] = !empty($flexconf['display_type']) ? $flexconf['display_type'] : '';
$processedData['tab']['switchEffect'] = !empty($parentflexconf['switch_effect']) ? $parentflexconf['switch_effect'] : '';
$processedData['tab']['contentByPid'] = !empty($flexconf['contentByPid']) ? $flexconf['contentByPid'] : 0;
$processedData['tab']['fill'] = !empty($flexconf['fill']) ? ' '.$flexconf['fill']: '';
}

/**
Expand Down
1 change: 0 additions & 1 deletion Classes/Helper/DefaultHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function getContainerClass(array $processedData, string $extConfContainer
}
}
}

if ($container) {
$processedData['containerPre'] = '<div class="'.trim($container).'">';
$processedData['containerPost'] = '</div>';
Expand Down
3 changes: 2 additions & 1 deletion Classes/Helper/T3sbsElementHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function getProcessedData($processedData, $flexconf, $parentflexconf, $an
$processedData['btn-block'] = true;
}
}
$headerPosition = '';
if ($processedData['data']['header_position']) {
$headerPosition = $processedData['data']['header_position'];
if ( $headerPosition == 'left' ) $headerPosition = '';
Expand All @@ -62,7 +63,7 @@ public function getProcessedData($processedData, $flexconf, $parentflexconf, $an
$processedData['slideInButton'] = FALSE;
$processedData['slideInButtonFaIcon'] = FALSE;

if ( $parentflexconf['fixedPosition'] == 'right'
if ( !empty($parentflexconf['fixedPosition']) && $parentflexconf['fixedPosition'] == 'right'
&& $parentflexconf['slideIn']
&& $parentflexconf['visiblePart']
&& $parentflexconf['vertical']
Expand Down
10 changes: 9 additions & 1 deletion Classes/Helper/WrapperHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function getBackgroundWrapper(array $processedData, array $flexconf, bool
// youtube
if ( $file->getMimeType() === 'video/youtube' || $file->getExtension() === 'youtube' ) {
$processedData['youtube'] = TRUE;
$processedData['vimeo'] = FALSE;
$processedData['isVideo'] = TRUE;
$processedData['contentPosition'] = $flexconf['contentPosition'];
$processedData['ytVideo']['bgHeight'] = $flexconf['bgHeight'];
Expand All @@ -52,6 +53,14 @@ public function getBackgroundWrapper(array $processedData, array $flexconf, bool
if ( $file->getMimeType() === 'video/vimeo' || $file->getExtension() === 'vimeo' ) {
// vimeo video
$processedData['vimeo'] = TRUE;
$processedData['youtube'] = FALSE;
$processedData['isVideo'] = TRUE;
$processedData['contentPosition'] = $flexconf['contentPosition'];
$processedData['ytVideo']['bgHeight'] = $flexconf['bgHeight'];
$processedData['ytVideo']['ytshift'] = $flexconf['ytshift'];
$processedData['videoAutoPlay'] = $file->getProperties()['autoplay'];
$youTubeRenderer = GeneralUtility::makeInstance(YouTubeRenderer::class);
$processedData['videoId'] = $youTubeRenderer->render($file);
} else {
// local video
$processedData['file'] = $file;
Expand Down Expand Up @@ -232,7 +241,6 @@ public function getCardWrapper(array $processedData, array $flexconf): array
}



/**
* Returns the $processedData
*/
Expand Down
23 changes: 23 additions & 0 deletions Classes/UserFunction/TcaMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,29 @@ public function isYoutube(array $arguments): bool
}


/**
* isVimeo
*/
public function isVimeo(array $arguments): bool
{
$vimeo = false;

if (is_int($arguments['record']['uid'])) {

$fileRepository = GeneralUtility::makeInstance(FileRepository::class);
$fileObjects = $fileRepository->findByRelation('tt_content', 'assets', $arguments['record']['uid']);
$file = !empty($fileObjects[0]) ? $fileObjects[0] : FALSE;

if (!empty($file)) {
if ( $file->getType() === 4 && ( $file->getMimeType() === 'video/vimeo' || $file->getExtension() === 'vimeo' ) ) {
$vimeo = true;
}
}
}

return $vimeo;
}

/**
* isLocalVideo
*/
Expand Down
7 changes: 3 additions & 4 deletions Classes/Utility/BackgroundImageUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
class BackgroundImageUtility implements SingletonInterface
{


protected $imageService;

public function __construct(
Expand Down Expand Up @@ -59,6 +58,7 @@ public function getBgImage(
}

$css = '';

if ( count($filesFromRepository) > 1 && $body == FALSE ) {
if ( !empty($flexconf['bgimagePosition']) && ( $flexconf['bgimagePosition'] == 1 || $flexconf['bgimagePosition'] == 2 ) ) {
// bg-images in two-columns
Expand All @@ -68,11 +68,10 @@ public function getBgImage(
$bgImages = $this->generateSrcsetImages($file, $image);
$imageUri_mobile = $webp ? $bgImages[576].'.webp' : $bgImages[576];
$css .= $this->generateCss('s'.$uid.'-'.$flexconf['bgimagePosition'], $file, $image, $webp, $flexconf, FALSE, $bgMediaQueries);

} else {
// slider in jumbotron or two bg-images in two-columns
if ( !empty($flexconf['bgimagePosition']) && $flexconf['bgimagePosition'] != 3 ) {
$uid = $frontendController->id;
}
$uid = $frontendController->id;
foreach($filesFromRepository as $fileKey=>$file) {
$fileKey = $fileKey+1;
$image[$fileKey] = $this->imageService->getImage((string)$file->getOriginalFile()->getUid(), $file->getOriginalFile(), true);
Expand Down
5 changes: 2 additions & 3 deletions Classes/ViewHelpers/MediaViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,10 @@ protected function renderPicture(FileInterface $image, $width, $height)
{
// Get crop variants
$cropString = $image instanceof FileReference ? $image->getProperty('crop') : '';


if ( $this->arguments['mobileNoRatio'] && $this->arguments['ratio'] ) {
$mobileImgManipulation = json_decode($cropString)->mobile;
}
if ( $this->arguments['ratio'] ) {
if ( !empty($cropString) && $this->arguments['ratio'] ) {
$cropString = self::getCropString($image, $cropString);
if ( $this->arguments['mobileNoRatio'] ) {
$cropObject = json_decode($cropString);
Expand Down Expand Up @@ -362,6 +360,7 @@ protected function getCropString($image, $cropString)
$cropObject = json_decode($cropString);
foreach($this->arguments['breakpoints'] as $cv) {
$cropVariant = $cv['cropVariant'];

$cropObject->$cropVariant->selectedRatio = $this->arguments['ratio'];
$cropedWidth = $image->getProperties()['width'] * $cropObject->$cropVariant->cropArea->width;
$cropedHeight = $image->getProperties()['height'] * $cropObject->$cropVariant->cropArea->height;
Expand Down
12 changes: 6 additions & 6 deletions Configuration/FlexForms/Bootstrap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
<alignSelf>
<TCEforms>
<label>Align self</label>
<displayCond>
<or>
<numIndex index="0">USER:T3SBS\T3sbootstrap\UserFunction\TcaMatcher->autoLayoutParent</numIndex>
<numIndex index="1">USER:T3SBS\T3sbootstrap\UserFunction\TcaMatcher->flexContainerParent</numIndex>
</or>
</displayCond>
<displayCond>
<or>
<numIndex index="0">USER:T3SBS\T3sbootstrap\UserFunction\TcaMatcher->autoLayoutParent</numIndex>
<numIndex index="1">USER:T3SBS\T3sbootstrap\UserFunction\TcaMatcher->flexContainerParent</numIndex>
</or>
</displayCond>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
Expand Down
Loading

0 comments on commit 06f6a44

Please sign in to comment.