Skip to content

Commit

Permalink
Merge pull request #225 from t3solution/5.1.17
Browse files Browse the repository at this point in the history
New release v5.1.17
  • Loading branch information
t3solution authored Jul 1, 2022
2 parents 84cbb9d + 7f56ebf commit 4d16e74
Show file tree
Hide file tree
Showing 21 changed files with 201 additions and 81 deletions.
23 changes: 23 additions & 0 deletions Classes/Components/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,29 @@ class Button implements SingletonInterface
*/
public function getProcessedData(array $processedData, array $flexconf, array $parentflexconf): array
{

$btnDropdownItem = [];
if ( !empty($flexconf['dropdownItems']) && is_array($flexconf['dropdownItems']) ) {
$processedData['dropdowndirection'] = !empty($flexconf['direction']) ? ' '.$flexconf['direction'] : '';
foreach ($flexconf['dropdownItems'] as $key=>$dropdownItem) {
$dIarray = explode(' ', $dropdownItem['list']['group']);
if (str_contains($dropdownItem['list']['group'], '"')) {
// if title have more than one word
$btnDropdownItem[$key]['link'] = $dIarray[0];
$btnDropdownItem[$key]['target'] = $dIarray[1] != '-' ? $dIarray[1] : '';
$btnDropdownItem[$key]['class'] = !empty($dIarray[2]) && $dIarray[2] != '-' ? $dIarray[2] : '';
$btnDropdownItem[$key]['title'] = !empty($dIarray[3]) && $dIarray[3] != '-' ? str_replace('"', '', $dIarray[3].' '.$dIarray[4]) : 'no tilte';
$btnDropdownItem[$key]['param'] = !empty($dIarray[5]) ? $dIarray[5] : '';
} else {
$btnDropdownItem[$key]['link'] = $dIarray[0];
$btnDropdownItem[$key]['target'] = !empty($dIarray[1]) && $dIarray[1] != '-' ? $dIarray[1] : '';
$btnDropdownItem[$key]['class'] = !empty($dIarray[2]) && $dIarray[2] != '-' ? $dIarray[2] : '';
$btnDropdownItem[$key]['title'] = !empty($dIarray[3]) && $dIarray[3] != '-' ? $dIarray[3] : 'no title';
$btnDropdownItem[$key]['param'] = !empty($dIarray[4]) ? $dIarray[4] : '';
}
}
}
$processedData['dropdownItems'] = !empty($btnDropdownItem) ? $btnDropdownItem : '';
$outline = !empty($flexconf['outline']) ? 'outline-':'';
$style = !empty($flexconf['style']) ? $flexconf['style'] : '';
$typolinkButtonClass = ' btn btn-'.$outline.$style;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ private function getUtilityColors(): array
}
foreach( $defaultUtilColors as $key=>$customvariables ) {
if (str_starts_with((string)$customvariables, '$')) {
if ($customScssArr[$customvariables])
if ( !empty($customScssArr[$customvariables]) && $customScssArr[$customvariables])
$defaultUtilityColors[$key] = $customScssArr[$customvariables];
} elseif ( str_starts_with((string)$customvariables, '#') ) {
if ($customvariables)
Expand Down
13 changes: 13 additions & 0 deletions Classes/UserFunction/TcaMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ public function buttonParent(array $arguments): bool
return $parent;
}

/**
* buttonGroup
*/
public function buttonGroup(array $arguments): bool
{
$group = false;
if ( !empty($arguments['record']['tx_container_parent'][0]) ) {
$group = true;
}

return $group;
}

/**
* cardWrapperParent
*/
Expand Down
8 changes: 3 additions & 5 deletions Classes/Utility/ResponsiveImagesUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function createPictureTag(
$referenceHeight = $fallbackImage->getProperty('height');

// if lazyload enabled add data- prefix
$attributePrefix = $lazyload ? 'data-' : '';
$attributePrefix = $lazyload && $lazyload != 3 ? 'data-' : '';

// Use last breakpoint as fallback image if it doesn't define a media query
$lastBreakpoint = array_pop($breakpoints);
Expand Down Expand Up @@ -239,14 +239,12 @@ public function createPictureSourceTag(
// Generate different image sizes for srcset attribute
$srcsetImages = $this->generateSrcsetImages($originalImage, $defaultWidth, $srcset, $cropArea, $absoluteUri, $webpIsLoaded, $type);
$srcsetMode = substr(key($srcsetImages), -1); // x or w

// Create source tag for this breakpoint
$sourceTag = GeneralUtility::makeInstance(TagBuilder::class, 'source');

if ($lazyload) {
if ($lazyload && $lazyload < 3) {
$sourceTag->addAttribute('data-srcset', $this->generateSrcsetAttribute($srcsetImages));
}

$sourceTag->addAttribute('srcset', $this->generateSrcsetAttribute($srcsetImages));

if ($mediaQuery) {
Expand Down
45 changes: 24 additions & 21 deletions Classes/ViewHelpers/MediaViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,18 @@ protected function renderPicture(FileInterface $image, $width, $height)
// Generate fallback image
$fallbackImage = $this->generateFallbackImage($image, $width, $cropArea);


if ( !empty($GLOBALS['_GET']['type']) && $GLOBALS['_GET']['type'] == '98' ) {
if ( !empty($GLOBALS['_GET']['type']) && $GLOBALS['_GET']['type'] == '98') {
$lazyload = 0;
} else {
if ($this->arguments['lazyload']) {
if ($this->arguments['lazyload'] == 1) {
$lazyload = $this->arguments['lazyload'];
$lazyload = 1;
} elseif ($this->arguments['lazyload'] == 3) {
$lazyload = 3;
$this->tag->addAttribute('loading', 'auto');
} else {
if ($this->arguments['lazyload'] == 2 && $image->getProperty('tx_t3sbootstrap_lazy_load')) {
$lazyload = (int)$this->arguments['lazyload'];
$lazyload = 2;
} else {
$lazyload = 0;
}
Expand All @@ -144,6 +146,7 @@ protected function renderPicture(FileInterface $image, $width, $height)
$lazyload = 0;
}
}

$placeholderSize = 0;
$placeholderInline = 0;
if ($lazyload) {
Expand Down Expand Up @@ -245,30 +248,30 @@ protected function renderImageTag(FileInterface $image, $width, $height, $fileEx
$processedImage->setIdentifier($webpIdentifier);
}

$imageUri = $imageService->getImageUri($processedImage);
$imageUri = $imageService->getImageUri($processedImage);

if (!$this->tag->hasAttribute('data-focus-area')) {
$focusArea = $cropVariantCollection->getFocusArea($cropVariant);
if (!$focusArea->isEmpty()) {
$this->tag->addAttribute('data-focus-area', $focusArea->makeAbsoluteBasedOnFile($image));
}
}
$this->tag->addAttribute('src', $imageUri);
$this->tag->addAttribute('width', $processedImage->getProperty('width'));
$this->tag->addAttribute('height', $processedImage->getProperty('height'));
if (in_array($this->arguments['loading'] ?? '', ['lazy', 'eager', 'auto'], true)) {
$this->tag->addAttribute('loading', $this->arguments['loading']);
}
if (!$this->tag->hasAttribute('data-focus-area')) {
$focusArea = $cropVariantCollection->getFocusArea($cropVariant);
if (!$focusArea->isEmpty()) {
$this->tag->addAttribute('data-focus-area', $focusArea->makeAbsoluteBasedOnFile($image));
}
}
$this->tag->addAttribute('src', $imageUri);
$this->tag->addAttribute('width', $processedImage->getProperty('width'));
$this->tag->addAttribute('height', $processedImage->getProperty('height'));
if ($this->arguments['lazyload'] == 3) {
$this->tag->addAttribute('loading', 'auto');
}

$alt = $image->getProperty('alternative');
$title = $image->getProperty('title');

// The alt-attribute is mandatory to have valid html-code, therefore add it even if it is empty
if (empty($this->arguments['alt'])) {
$this->tag->addAttribute('alt', $alt);
if (empty($this->arguments['alt'])) {
$this->tag->addAttribute('alt', $alt);
}
if (empty($this->arguments['title']) && $title) {
$this->tag->addAttribute('title', $title);
$this->tag->addAttribute('title', $title);
}

return $this->tag->render();
Expand All @@ -287,7 +290,7 @@ protected function getCropString($image, $cropString)
$cropObject->$cropVariant->selectedRatio = $this->arguments['ratio'];
$cropedWidth = $image->getProperties()['width'] * $cropObject->$cropVariant->cropArea->width;
$cropedHeight = $image->getProperties()['height'] * $cropObject->$cropVariant->cropArea->height;
$rArr = explode(':',$this->arguments['ratio']);
$rArr = explode(':',$this->arguments['ratio']);
if ( $this->arguments['shift'] ) {
$shift = $this->arguments['shift'] > 0 ? $cropObject->$cropVariant->cropArea->y + $this->arguments['shift']
: $cropObject->$cropVariant->cropArea->y - ($this->arguments['shift'] * -1);
Expand Down
3 changes: 1 addition & 2 deletions Classes/Wrapper/ButtonGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ class ButtonGroup implements SingletonInterface
public function getProcessedData(array $processedData, array $flexconf): array
{
$processedData['class'] .= !empty($flexconf['vertical']) ? ' btn-group-vertical' : ' btn-group';
$processedData['class'] .= !empty($flexconf['btnsize']) && $flexconf['btnsize'] != 'default' ? ' '.$flexconf['btnsize']: '';
$processedData['class'] .= !empty($flexconf['btnsize']) && $flexconf['btnsize'] != 'null' ? ' '.$flexconf['btnsize'] : '';
$processedData['buttonGroupClass'] = !empty($flexconf['align']) ? $flexconf['align'] : '';

$processedData['visiblePart'] = '';

if ( !empty($flexconf['fixedPosition']) ) {
Expand Down
52 changes: 52 additions & 0 deletions Configuration/FlexForms/Button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,58 @@
</config>
</TCEforms>
</linkTitle>
<dropdownItems>
<section>1</section>
<type>array</type>
<el>
<list>
<title>Dropdown Item</title>
<type>array</type>
<el>
<group>
<TCEforms>
<label>Input Link</label>
<config>
<type>input</type>
<renderType>inputLink</renderType>
<size>48</size>
</config>
</TCEforms>
</group>
</el>
</list>
</el>
</dropdownItems>
<direction>
<TCEforms>
<label>Dropdown direction</label>
<description>Trigger dropdown menus direction (if dropdown items)</description>
<displayCond>USER:T3SBS\T3sbootstrap\UserFunction\TcaMatcher->buttonGroup</displayCond>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">dropdown</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">Dropup</numIndex>
<numIndex index="1">dropup</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">Dropright</numIndex>
<numIndex index="1">dropend</numIndex>
</numIndex>
<numIndex index="3" type="array">
<numIndex index="0">Dropleft</numIndex>
<numIndex index="1">dropstart</numIndex>
</numIndex>
</items>
<default></default>
</config>
</TCEforms>
</direction>
</el>
</ROOT>
</sDEF>
Expand Down
7 changes: 0 additions & 7 deletions Configuration/FlexForms/CardContent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<sheetTitle>Content</sheetTitle>
</TCEforms>
<type>array</type>

<el>
<header.text>
<TCEforms>
Expand All @@ -20,7 +19,6 @@
</config>
</TCEforms>
</header.text>

<text.top>
<TCEforms>
<label>Text Top</label>
Expand All @@ -32,8 +30,6 @@
</config>
</TCEforms>
</text.top>


<list.container>
<section>1</section>
<type>array</type>
Expand All @@ -55,7 +51,6 @@
</list>
</el>
</list.container>

<text.bottom>
<TCEforms>
<label>Text Bottom (optional: new .card-block)</label>
Expand All @@ -67,7 +62,6 @@
</config>
</TCEforms>
</text.bottom>

<footer.text>
<TCEforms>
<label>Card Footer</label>
Expand All @@ -80,7 +74,6 @@
</config>
</TCEforms>
</footer.text>

</el>
</ROOT>
</sDEF>
Expand Down
7 changes: 5 additions & 2 deletions Configuration/TypoScript/Page/IncludeCdn.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ page {
lazyloadCDN = https://cdn.jsdelivr.net/npm/vanilla-lazyload@{$bootstrap.cdn.lazyload}/dist/lazyload.min.js
lazyloadCDN.integrity = {$bootstrap.cdn.lazyloadIntegrity}
lazyloadCDN.external = 1
lazyloadCDN.if.isTrue = {$bootstrap.extconf.lazyLoad}
lazyloadCDN.if {
value = 1,2
isInList = {$bootstrap.extconf.lazyLoad}
}

##########################################################################################################
#
Expand All @@ -104,7 +107,7 @@ page {
61 = TEXT
61.value = <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/{$bootstrap.cdn.fontawesome}/js/all.min.js" data-auto-replace-svg="nest"></script>
61.if {
value = 1,3
value = 1,3
isInList = {$bootstrap.extconf.fontawesomeCss}
}
}
Expand Down
7 changes: 5 additions & 2 deletions Configuration/TypoScript/Page/IncludeLocal.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ page {

lazyload = /fileadmin/T3SB/Resources/Public/JS/lazyload.min.js
lazyload.if.isTrue = {$bootstrap.extconf.lazyLoad}

lazyload.if {
value = 1,2
isInList = {$bootstrap.extconf.lazyLoad}
}
##########################################################################################################
#
# PICTUREFILL
Expand All @@ -83,7 +86,7 @@ page {
61 = TEXT
61.value = <script src="/fileadmin/T3SB/Resources/Public/JS/fontawesome.min.js" data-auto-replace-svg="nest"></script>
61.if {
value = 1,3
value = 1,3
isInList = {$bootstrap.extconf.fontawesomeCss}
}
}
Expand Down
2 changes: 0 additions & 2 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,9 @@ temp.pagelayout {
# Google Tag Manager
#
##########################################################################################################

[request.getCookieParams()['cookieconsent_status'] == 'allow']
page.jsInline.1 = TEXT
page.jsInline.1.value (

// Google Tag Manager
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Layouts/Content/Button.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</f:then>
<f:else>
<f:comment> BUTTON GROUP </f:comment>
<div id="c{data.uid}"{f:if(condition: '{buttonGroupClass}',then: ' class="{buttonGroupClass}"')} role="group" aria-label="btn-{data.uid}">
<div id="c{data.uid}"{f:if(condition: '{buttonGroupClass}',then: ' class="{buttonGroupClass}"')}>
<f:render section="Main" arguments="{_all}" />
</div>
</f:else>
Expand Down
10 changes: 6 additions & 4 deletions Resources/Private/Partials/Content/Media/Rendering/Image.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
<f:variable name="ratio" value="{f:if(condition: '{dimensions.ratio}', then: '{dimensions.ratio}', else: '{addmedia.ratio}')}" />






<f:if condition="{addmedia.origImg}">
<f:then>
<f:image class="img-fluid{extraImgClass}" src="fileadmin/{file.identifier}" />
Expand Down Expand Up @@ -55,3 +51,9 @@
</f:else>
</f:if>
</html>



<f:comment>
loading="{settings.media.lazyLoading}"
</f:comment>
14 changes: 5 additions & 9 deletions Resources/Private/Templates/Container/Collapsible.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@ <h2 class="accordion-header" id="heading-{data.uid}">
title=""
alt=""
class="float-left me-3"
width="60"
height="60"
breakpoints="{
0: {'cropVariant': 'default', 'media': '(min-width: 1200px)', 'srcset': '{settings.srcsetDesktop}'},
1: {'cropVariant': 'tablet', 'media': '(min-width: 576px)', 'srcset': '{settings.srcsetTablet}'},
2: {'cropVariant': 'mobile', 'media': '(max-width: 575px)', 'srcset': '{settings.srcsetMobile}'}
}"
imgtag="false"
picturefill="{settings.picturefill}"
width="60c"
height="60c"
breakpoints=""
imgtag="true"
picturefill="0"
lazyload="{settings.lazyLoad}"
ratio="{ratio}"
/>
Expand Down
Loading

0 comments on commit 4d16e74

Please sign in to comment.