Skip to content

Commit

Permalink
Merge pull request #143 from t3solution/5.1.0
Browse files Browse the repository at this point in the history
New version 5.1.0
  • Loading branch information
t3solution authored Oct 4, 2021
2 parents 484c05f + ced1361 commit cf7197a
Show file tree
Hide file tree
Showing 42 changed files with 1,595 additions and 376 deletions.
30 changes: 26 additions & 4 deletions Classes/Backend/Preview/T3sbPreviewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,16 @@ public function renderPageModulePreviewContent(GridColumnItem $item): string
if ( $flexconf['equalWidth'] ) {
$out .= '<br />- Equal Width';
}
if ( $flexconf['equalHeight'] ) {
$out .= '<br />- Equal Height';
if ( $flexconf['horizontalGutters'] ) {
$out .= '<br />- Horizontal gutters: '.$flexconf['horizontalGutters'];
}
if ( $flexconf['noGutters'] ) {
$out .= '<br />- No Gutters';
}
if ($record['CType'] == 'two_columns') {
if ($flexconf['bgimages']) {
$out .= '<br />- Has Background-image';
}
if ( $flexconf['colHeight'] ) {
$out .= '<br />- Min.-Height of the Element: '.$flexconf['colHeight'].'px';
}
}
if ($record['CType'] == 'button_group') {
Expand Down Expand Up @@ -180,6 +185,20 @@ public function renderPageModulePreviewContent(GridColumnItem $item): string
$out .= '<br />- Zoom';
}
}
if ($record['CType'] == 'swiper_container') {
if ( $flexconf['width'] ) {
$out .= '<br />- Width: '.$flexconf['width'].'px';
}
if ( $flexconf['ratio'] ) {
$out .= '<br />- Aspect ratio: '.$flexconf['ratio'];
}
if ( $flexconf['slidesPerView'] ) {
$out .= '<br />- Slides per view: '.$flexconf['slidesPerView'];
}
if ( $flexconf['delay'] ) {
$out .= '<br />- Delay between transitions (in ms): '.$flexconf['delay'];
}
}
if ($record['CType'] == 'card_wrapper') {
$out .= '<br />- Wrapper: Card '.$flexconf['card_wrapper'];
if ( $flexconf['visibleCards'] ) {
Expand Down Expand Up @@ -228,6 +247,9 @@ public function renderPageModulePreviewContent(GridColumnItem $item): string
if ( $flexconf['addHeight'] ) {
$out .= '<br />- Surcharge height to parallax view: '.$flexconf['addHeight'].'px';
}
if ( $flexconf['mobile'] ) {
$out .= '<br />- Disable on mobile devices!';
}
}
if ($record['CType'] === 'modal') {

Expand Down
23 changes: 19 additions & 4 deletions Classes/Command/CdnToLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,17 +330,32 @@ protected function execute(InputInterface $input, OutputInterface $output)
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

if ($key == 'parallaxVanilla') {
if ($key == 'jarallax') {
$customDir = 'fileadmin/T3SB/Resources/Public/JS/';
$customPath = GeneralUtility::getFileAbsFileName($customDir);
$customFileName = 'parallax-vanilla.min.js';
$cdnPath = 'https://cdn.jsdelivr.net/npm/parallax-vanilla@'.$version.'/dist/'.$customFileName;
$customFileName = 'jarallax.min.js';
$cdnPath = 'https://unpkg.com/jarallax@'.$version.'/dist/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
$customFileName = 'jarallax-video.min.js';
$cdnPath = 'https://unpkg.com/jarallax@'.$version.'/dist/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}

if ($key == 'swiper') {
$customDir = 'fileadmin/T3SB/Resources/Public/CSS/';
$customPath = GeneralUtility::getFileAbsFileName($customDir);
$customFileName = 'swiper-bundle.min.css';
$cdnPath = 'https://unpkg.com/swiper@'.$version.'/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
$customDir = 'fileadmin/T3SB/Resources/Public/JS/';
$customPath = GeneralUtility::getFileAbsFileName($customDir);
$customFileName = 'swiper-bundle.min.js';
$cdnPath = 'https://unpkg.com/swiper@'.$version.'/'.$customFileName;
self::writeCustomFile($customPath, $customFileName, $cdnPath);
}
}

return 0;

}

private function writeCustomFile($customPath, $customFileName, $cdnPath, $extend=false ) {
Expand Down
51 changes: 50 additions & 1 deletion Classes/DataProcessing/BootstrapProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$processedData['style'] = $styleHelper->getBgColor($processedData['data']);

$processedData['isTxContainer'] = FALSE;

/**
* Grid System
*/
Expand Down Expand Up @@ -177,6 +177,46 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
}
}


/**
* Swiper container
*/
if ( $processedData['data']['CType'] == 'swiper_container' ) {
$processedData['isTxContainer'] = TRUE;
$processedData['swiperCss'] = $flexconf['swiperCss'];
$processedData['swiperJs'] = $flexconf['swiperJs'];
$processedData['sliderStyle'] = $flexconf['sliderStyle'];
$processedData['width'] = $flexconf['width'];
$processedData['ratio'] = $flexconf['ratio'];
$processedData['slidesPerView'] = (int)$flexconf['slidesPerView'] ?: 4;
$processedData['breakpoints576'] = (int)$flexconf['breakpoints576'] ?: 2;
$processedData['breakpoints768'] = (int)$flexconf['breakpoints768'] ?: 3;
$processedData['breakpoints992'] = (int)$flexconf['breakpoints992'] ?: 4;
$processedData['slidesPerGroup'] = (int)$flexconf['slidesPerGroup'];
$processedData['spaceBetween'] = (int)$flexconf['spaceBetween'];
$processedData['loop'] = (int)$flexconf['loop'];
$processedData['navigation'] = (int)$flexconf['navigation'];
$processedData['pagination'] = (int)$flexconf['pagination'];
$processedData['autoplay'] = (int)$flexconf['autoplay'];
$processedData['delay'] = $flexconf['autoplay'] ? (int)$flexconf['delay'] : 99999999;
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
$queryBuilder = $connectionPool->getQueryBuilderForTable('tt_content');
$statement = $queryBuilder
->select('uid')
->from('tt_content')
->where(
$queryBuilder->expr()->eq('tx_container_parent', $queryBuilder->createNamedParameter($processedData['data']['uid'], \PDO::PARAM_INT))
)
->execute()
->fetchAll();
$fileRepository = GeneralUtility::makeInstance(FileRepository::class);
foreach($statement as $element) {
$filesFromRepository[$element['uid']] = $fileRepository->findByRelation('tt_content', 'image', $element['uid']);
}
$processedData['swiperSlides'] = $filesFromRepository;
}


/**
* Collapse Container
*/
Expand Down Expand Up @@ -384,6 +424,15 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
if ($flexconf['shift']){
$processedData['shift'] = (int)$flexconf['shift'] / 100;
}
if ( $parentflexconf['owlCarousel'] ) {
$processedData['owlCarousel'] = TRUE;

}

if ( $parentflexconf['swiperJs'] ) {
$processedData['swiper'] = TRUE;

}
}

/**
Expand Down
8 changes: 5 additions & 3 deletions Classes/DataProcessing/GalleryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,11 @@ protected function calculateMediaWidthsAndHeights()

$bsGridWidth = self::getCalculatedGridWidth($bsGridWidth);
} else {
# $bsGridWidth = $bsGridWidth - 30;
#$bsGridWidth = $bsGridWidth - 30;
}

$galleryWidth = $bsGridWidth / 100 * $rowWidth;
$imagePadding = self::getImagePadding();
$imagePadding = self::getImagePadding($bsGridWidth);

$mediaWidth = ($galleryWidth - $imagePadding ) / $this->galleryData['count']['columns'];
}
Expand Down Expand Up @@ -992,9 +992,11 @@ protected function getGridWidth($bsGridWidth, $suffix)
/**
* Returns $imagepadding
*
* @param int $bsGridWidth
*
* @return int $imagepadding
*/
protected function getImagePadding()
protected function getImagePadding($bsGridWidth)
{

if ( $this->cType == 't3sbs_card' && $this->processedData['data']['tx_container_parent']
Expand Down
29 changes: 29 additions & 0 deletions Classes/Domain/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,13 @@ class Config extends AbstractEntity
*/
protected $sidebarMenuPosition = '';

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

/**
* sidebarSectionMobile
*
Expand Down Expand Up @@ -3838,4 +3845,26 @@ public function setSidebarSectionMobile($sidebarSectionMobile)
$this->sidebarSectionMobile = $sidebarSectionMobile;
}

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

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


}
60 changes: 45 additions & 15 deletions Classes/Helper/WrapperHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,23 @@ public function getCardWrapper($processedData, $flexconf): array
$processedData['flipper']['class'] = 'col-xs-12 col-sm-6 col-md-4';
}
}

// swiperjs
if ($flexconf['card_wrapper'] == 'slider') {
$processedData['class'] .= ' mx-n3';
$processedData['visibleCards'] = (int)$flexconf['visibleCards'] ?: 3;
$processedData['cols'] = floor(12 / $processedData['visibleCards']);
$processedData['width'] = $flexconf['width'];
$processedData['ratio'] = $flexconf['ratio'];
$processedData['slidesPerView'] = (int)$flexconf['slidesPerView'] ?: 4;
$processedData['breakpoints576'] = (int)$flexconf['breakpoints576'] ?: 2;
$processedData['breakpoints768'] = (int)$flexconf['breakpoints768'] ?: 3;
$processedData['breakpoints992'] = (int)$flexconf['breakpoints992'] ?: 4;
$processedData['slidesPerGroup'] = (int)$flexconf['slidesPerGroup'];
$processedData['spaceBetween'] = (int)$flexconf['spaceBetween'];
$processedData['loop'] = (int)$flexconf['loop'];
$processedData['navigation'] = (int)$flexconf['navigation'];
$processedData['pagination'] = (int)$flexconf['pagination'];
$processedData['autoplay'] = (int)$flexconf['autoplay'];
$processedData['delay'] = $flexconf['autoplay'] ? (int)$flexconf['delay'] : 99999999;
}
}
$processedData['card_wrapper_layout'] = $flexconf['card_wrapper'] ?: '';
Expand Down Expand Up @@ -299,7 +311,7 @@ public function getCarouselContainer($processedData, $flexconf): array
$block = '#multiSlider-'.$processedData['data']['uid'].' .MS-content .item {width: '.$flexconf['number'].'}';

$processedData['multislider'] = TRUE;
$processedData['jsOptions'] = '{'.$options.'}';
$processedData['jsOptions'] = '{'.$options.'}';
$processedData['cssBlock'] = $block;
}

Expand All @@ -313,10 +325,8 @@ public function getCarouselContainer($processedData, $flexconf): array
$processedData['maxWidth'] = $flexconf['width'].'px';
$processedData['interval'] = $flexconf['interval'];
$processedData['darkVariant'] = $flexconf['darkVariant'];

$processedData['carouselFade'] = $flexconf['carouselFade'] ? ' carousel-fade': '';
$processedData['carouselFade'] .= $flexconf['darkVariant'] ? ' carousel-dark': '';

$processedData['thumbnails'] = $flexconf['thumbnails'] ? true : false;

return $processedData;
Expand All @@ -336,23 +346,44 @@ public function getParallaxWrapper($processedData, $flexconf, $webp=FALSE): arra
$fileRepository = GeneralUtility::makeInstance(FileRepository::class);
$file = $fileRepository->findByRelation('tt_content', 'assets', (int)$processedData['data']['uid'])[0];
$processedData['file'] = $file;

if ( $file ) {
if ( $file->getType() === 4 ) {
$processedData['video'] = TRUE;
if ( $file->getMimeType() === 'video/youtube' || $file->getExtension() === 'youtube' ) {
// youtube video
$processedData['youtube'] = TRUE;
$events = $flexconf;
$events['videoAutoPlay'] = $file->getProperties()['autoplay'];
$events['uid'] = $processedData['data']['uid'];
$processedData['videoId'] = GeneralUtility::makeInstance(YouTubeRenderer::class)->render($file, $events, true);
} elseif ( $file->getMimeType() === 'video/vimeo' || $file->getExtension() === 'vimeo' ) {
// vimeo video
$processedData['vimeo'] = TRUE;
$processedData['videoId'] = GeneralUtility::makeInstance(YouTubeRenderer::class)->render($file, $events, true);
} else {
// local video
$processedData['local'] = TRUE;
if ( $file->getMimeType() == 'video/mp4' ) {
$processedData['mimeType'] = 'mp4' ;
}
if ( $file->getMimeType() == 'video/webm' ) {
$processedData['mimeType'] = 'webm' ;
}
if ( $file->getMimeType() == 'video/ogv' ) {
$processedData['mimeType'] = 'ogv' ;
}
$processedData['file'] = $file;
}
} else {
$bgImage = GeneralUtility::makeInstance(BackgroundImageUtility::class)
->getBgImage($processedData['data']['uid'], 'tt_content', FALSE, FALSE, [], FALSE, FALSE, $webp);

$processedData['parallaxImageUid'] = $bgImage[0];
$processedData['parallaxImage'] = $bgImage[1];
$processedData['speedFactor'] = $flexconf['speedFactor'];
$processedData['addHeight'] = (int)$flexconf['addHeight'] ?: 0;
$processedData['parallaxImage'] = $bgImage;
}
}

if ($flexconf['paddingTopBottom']) {
$processedData['style'] .= ' padding: '.$flexconf['paddingTopBottom'].'rem 1rem;';
$processedData['width'] = $flexconf['width'];
$processedData['speedFactor'] = $flexconf['speedFactor'] ?: 1;
$processedData['addHeight'] = (int)$flexconf['addHeight'] ?: 0;
$processedData['no-mobile'] = $flexconf['mobile'] ? '/iPad|iPhone|iPod|Android/' : '-';
}

return $processedData;
Expand All @@ -374,7 +405,6 @@ public function getCollapsible($processedData, $flexconf, $parentflexconf): arra

$processedData['appearance'] = $parentflexconf['appearance'];
$processedData['show'] = $flexconf['active'] ? ' show' : '';
$processedData['expanded'] = $flexconf['active'] ? 'true' : 'false';
$processedData['collapsed'] = $flexconf['active'] ? '' : ' collapsed';
$processedData['expanded'] = $flexconf['active'] ? 'true' : 'false';
$processedData['buttonstyle'] = $flexconf['style'] ? $flexconf['style'] : 'primary';
Expand Down
6 changes: 5 additions & 1 deletion Classes/Utility/YouTubeRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function getOnlineMediaHelper(FileInterface $file)
* @param array $events
* @return string
*/
public function render(FileInterface $file, $events)
public function render(FileInterface $file, $events, $idOnly=false)
{
if ($file instanceof FileReference) {
$orgFile = $file->getOriginalFile();
Expand All @@ -99,6 +99,10 @@ public function render(FileInterface $file, $events)
$addEvents .= $events['videoRaster'] ? ', addRaster: true' : '';
$addEvents .= $events['videoGaTrack'] ? '' : ', gaTrack: false';

if ($idOnly) {
return $videoId;
}

return "{videoURL:'".$videoId."', containment:'#dom".$events['uid']."', showControls:".$showControls.", ratio:'".$ratio."', quality: '".$quality."', opacity:1, autoPlay:".$autoPlay.", mute:".$mute.", startAt:0".$addEvents."}";

}
Expand Down
Loading

0 comments on commit cf7197a

Please sign in to comment.