From fa2f9a34045048c74847a35b8f45ef4349fea9c7 Mon Sep 17 00:00:00 2001 From: Helmut Hackbarth Date: Sat, 8 Apr 2023 17:43:17 +0200 Subject: [PATCH] BUGFIX release v5.2.10 --- Classes/DataProcessing/BootstrapProcessor.php | 43 ++++++++++++++++++- Classes/Helper/ClassHelper.php | 4 +- Classes/Helper/DefaultHelper.php | 1 + Configuration/TSConfig/Page.tsconfig | 27 ++++++++++++ .../TypoScript/Lib/ContentElement.typoscript | 1 + Configuration/TypoScript/constants.typoscript | 2 + .../Private/Layouts/Content/Default.html | 4 +- .../Container/CarouselContainer.html | 2 +- ext_emconf.php | 2 +- ext_localconf.php | 4 +- 10 files changed, 81 insertions(+), 9 deletions(-) diff --git a/Classes/DataProcessing/BootstrapProcessor.php b/Classes/DataProcessing/BootstrapProcessor.php index 1d71fab9..e84c7ad9 100644 --- a/Classes/DataProcessing/BootstrapProcessor.php +++ b/Classes/DataProcessing/BootstrapProcessor.php @@ -109,9 +109,14 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu $processedData['data']['configuid'] = (int)$processorConfiguration['configuid']; $processedData['header_fontawesome'] = ''; + $sectionMenuClass = ''; + if (!empty($contentObjectConfiguration['settings.']['sectionMenuClass'])) { + $sectionMenuClass = $contentObjectConfiguration['settings.']['sectionMenuClass']; + } + // class $classHelper = GeneralUtility::makeInstance(ClassHelper::class); - $class = $classHelper->getDefaultClass($processedData['data'], $flexconf, $extConf['cTypeClass']); + $class = $classHelper->getDefaultClass($processedData['data'], $flexconf, $extConf['cTypeClass'], $sectionMenuClass); $processedData['class'] = !empty($processedData['class']) ? $processedData['class'].' '.$class : $class; // header class @@ -311,6 +316,16 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu $processedData['class'] .= $classHelper->getContainerClass($parentflexconf, $flexconf); } + $processedData['dataAttr'] = ''; + if (!empty($processedData['data']['tx_content_animations_animation'])) { + $completeAnimationSettings = $this->generateAnimationAttributeSettingsFromAnimationsArray($processedData['data']); + $processedData['dataAttr'] = !empty($completeAnimationSettings) ? $completeAnimationSettings : ''; + $processedData['dataAnimate'] = ''; + $processedData['isAnimateCss'] = FALSE; + $processedData['animateCssRepeat'] = FALSE; + $flexconf['animate'] = ''; + } + // container class $defaultHelper = GeneralUtility::makeInstance(DefaultHelper::class); $processedData = $defaultHelper->getContainerClass($processedData, $extConf['container']); @@ -337,4 +352,30 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu return $processedData; } + + + + /** + * @param array $animationSettingsArray + * @return string + */ + private function generateAnimationAttributeSettingsFromAnimationsArray(array $animationSettingsArray) + { + $animationSettings = ''; + + foreach ($animationSettingsArray as $key => $value) { + if (str_starts_with($key, 'tx_content_animations_')) { + if ($key == 'tx_content_animations_animation' ) { + $newphrase = str_replace('tx_content_animations_animation', 'data-aos', $key); + $animationSettings .= $newphrase . '="' . $value . '" '; + } else { + $newphrase = str_replace('tx_content_animations_', 'data-aos-', $key); + $animationSettings .= $newphrase . '="' . $value . '" '; + } + } + } + return ' '.$animationSettings; + } + + } diff --git a/Classes/Helper/ClassHelper.php b/Classes/Helper/ClassHelper.php index 0770d17b..f2ff5967 100644 --- a/Classes/Helper/ClassHelper.php +++ b/Classes/Helper/ClassHelper.php @@ -19,7 +19,7 @@ class ClassHelper implements SingletonInterface /** * Returns the CSS-class for default elements */ - public function getDefaultClass(array $data, array $flexconf, string $cTypeClass): string + public function getDefaultClass(array $data, array $flexconf, string $cTypeClass, string $sectionMenuClass): string { // class if ( $cTypeClass ) { @@ -145,7 +145,7 @@ public function getDefaultClass(array $data, array $flexconf, string $cTypeClass } } - if ($data['sectionIndex']) { + if ($sectionMenuClass) { $class .= ' section-index'; } diff --git a/Classes/Helper/DefaultHelper.php b/Classes/Helper/DefaultHelper.php index 8896cf15..2ee7b091 100644 --- a/Classes/Helper/DefaultHelper.php +++ b/Classes/Helper/DefaultHelper.php @@ -149,6 +149,7 @@ public function getDefaults( $processedData['data']['image_zoom'] = ''; $processedData['addmedia']['imagezoom'] = ''; } + // animate css for all CEs exept t3sbs_carousel & collapsible_accordion if ($animateCss && (!empty($processedData['data']['tx_t3sbootstrap_animateCss']) || !empty($flexconf['animate'])) && $cType != 't3sbs_carousel' && $cType != 'collapsible_accordion') diff --git a/Configuration/TSConfig/Page.tsconfig b/Configuration/TSConfig/Page.tsconfig index 5f25c645..afbb8fd7 100644 --- a/Configuration/TSConfig/Page.tsconfig +++ b/Configuration/TSConfig/Page.tsconfig @@ -426,5 +426,32 @@ TCEFORM.tt_content { t3sbs_carousel.disabled = 1 } } + tx_content_animations_animation { + types { + collapsible_accordion.disabled = 1 + t3sbs_carousel.disabled = 1 + tabs_tab.disabled = 1 + listGroup_wrapper.disabled = 1 + t3sbs_button.disabled = 1 + } + } + tx_content_animations_duration { + types { + collapsible_accordion.disabled = 1 + t3sbs_carousel.disabled = 1 + tabs_tab.disabled = 1 + listGroup_wrapper.disabled = 1 + t3sbs_button.disabled = 1 + } + } + tx_content_animations_delay { + types { + collapsible_accordion.disabled = 1 + t3sbs_carousel.disabled = 1 + tabs_tab.disabled = 1 + listGroup_wrapper.disabled = 1 + t3sbs_button.disabled = 1 + } + } } diff --git a/Configuration/TypoScript/Lib/ContentElement.typoscript b/Configuration/TypoScript/Lib/ContentElement.typoscript index 3ce0ac8f..2fe07af3 100644 --- a/Configuration/TypoScript/Lib/ContentElement.typoscript +++ b/Configuration/TypoScript/Lib/ContentElement.typoscript @@ -95,6 +95,7 @@ lib.contentElement { webp = {$bootstrap.extconf.webp} btnSlideOutCorrection = 21 t3sbconcatenate = {$bootstrap.extconf.t3sbconcatenate} + sectionMenuClass = {$bootstrap.config.sectionMenuClass} // used also with config config { sectionmenuAnchorOffset = {$bootstrap.config.sectionmenuAnchorOffset} diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript index fd651ab6..eca7a407 100644 --- a/Configuration/TypoScript/constants.typoscript +++ b/Configuration/TypoScript/constants.typoscript @@ -228,6 +228,8 @@ bootstrap.config.enableUtilityColors = 1 # hints to increase the website speed in the BE Modul bootstrap.config.enableInfo = 1 +bootstrap.config.sectionMenuClass = 0 + # include print template bootstrap.print.enable = 0 diff --git a/Resources/Private/Layouts/Content/Default.html b/Resources/Private/Layouts/Content/Default.html index 9e9be7a6..bf915de6 100644 --- a/Resources/Private/Layouts/Content/Default.html +++ b/Resources/Private/Layouts/Content/Default.html @@ -15,7 +15,7 @@ -
+
f:format.raw()}> @@ -23,7 +23,7 @@
-
f:format.raw()}{styleAttr -> f:format.raw()}> +
f:format.raw()}{styleAttr -> f:format.raw()}{dataAttr -> f:format.raw()}> diff --git a/Resources/Private/Templates/Container/CarouselContainer.html b/Resources/Private/Templates/Container/CarouselContainer.html index bde87be6..4eef2e4c 100644 --- a/Resources/Private/Templates/Container/CarouselContainer.html +++ b/Resources/Private/Templates/Container/CarouselContainer.html @@ -26,7 +26,7 @@ function t3sbLocalCarouselVideo(videoCarousel) { videoCarousel.addEventListener('slide.bs.carousel', function (el) { let slides = this.getElementsByClassName('carousel-item'); - slides.forEach( carouselItem => { + Array.from(slides).forEach( carouselItem => { if ( carouselItem.classList.contains('active') ) { if ( carouselItem.classList.contains('carousel-video') ) { carouselItem.getElementsByTagName('video')[0].play(); diff --git a/ext_emconf.php b/ext_emconf.php index 547fe3fa..591a85ab 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -14,7 +14,7 @@ 'title' => 'Bootstrap Components', 'description' => 'Startup extension to use bootstrap 5 classes, components and more out of the box. Example and info: www.t3sbootstrap.de', 'category' => 'templates', - 'version' => '5.2.9', + 'version' => '5.2.10', 'state' => 'stable', 'clearCacheOnLoad' => true, 'author' => 'Helmut Hackbarth', diff --git a/ext_localconf.php b/ext_localconf.php index 98babfc9..63ef0aac 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -195,9 +195,9 @@ // Optional lazyLoad if (array_key_exists('lazyLoad', $extconf)) { \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptConstants('bootstrap.extconf.lazyLoad = '.$extconf['lazyLoad']); - } + } // Optional animateCss - if (array_key_exists('animateCss', $extconf) && $extconf['animateCss'] > '0') { + if (array_key_exists('animateCss', $extconf) && $extconf['animateCss'] > '0' && !\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('content_animations')) { \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptConstants('bootstrap.extconf.animateCss = '.$extconf['animateCss']); } // Optional select-field for a .container or .container-fluid class in any content element