Skip to content

Commit

Permalink
Merge pull request #209 from t3solution/5.1.13
Browse files Browse the repository at this point in the history
New release v5.1.13
  • Loading branch information
t3solution committed May 23, 2022
2 parents de5aefa + 9cc1ac4 commit 076dcfc
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 177 deletions.
86 changes: 46 additions & 40 deletions Classes/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ public function getCustomScss( string $file ): array
->execute();

$siteroots = $result->fetchAll();

$customScssFileName = '';

foreach ($siteroots as $key=>$siteroot) {
Expand All @@ -492,12 +491,10 @@ public function getCustomScss( string $file ): array
if ( file_exists($customScssFile) ) {

$customScssFile = $customScssFilePath.$customScssFileName;

if ($file == 'custom') {
$assignedOptions['customScss'] = TRUE;
}
$arguments = $this->request->getArguments();

if ( !empty($arguments['t3sbootstrap'][$file]) ) {
$scss = $arguments['t3sbootstrap'][$file];
} else {
Expand Down Expand Up @@ -674,62 +671,71 @@ private function getUtilityColors(): array
{
$defaultUtilColorsList = '$white,$gray-100,$gray-200,$gray-300,$gray-400,$gray-500,$gray-600,$gray-700,$gray-800,$gray-900,$black,$blue,$indigo,$purple,$pink,$red,$orange,$yellow,$green,$teal,$cyan,$primary,$secondary,$success,$info,$warning,$danger,$light,$dark';
$utilityColors = [];
$utilColors = [];
$colors = [];
$customScssArr = [];
$defaultUtilityColors = [];
$defaultcolors = [];

$customScss = self::getCustomScss('custom-variables');
if (!empty($customScss['custom-variables'])) {
$customScssArr = GeneralUtility::trimExplode(';', $customScss['custom-variables']);
foreach( $customScssArr as $customvariables ) {
$custom_variables = empty($customScss['custom-variables']) ? '' : preg_replace('/\s+/', ' ', trim($customScss['custom-variables']));
$default = '// Overrides Bootstrap variables // $enable-shadows: true; // $enable-gradients: true; // $enable-negative-margins: true;';

if ( !empty($customScss['custom-variables']) && str_starts_with($custom_variables, $default) == FALSE ) {
foreach( GeneralUtility::trimExplode(';', $customScss['custom-variables']) as $customvariables ) {
$scsscolor = GeneralUtility::trimExplode(':', $customvariables);
if ( !empty($scsscolor[1]) && str_starts_with((string)$scsscolor[1], '$')
&& GeneralUtility::inList($defaultUtilColorsList, $scsscolor[0]) ) {
$utilColors[$scsscolor[0]] = $scsscolor[1];
} elseif (!empty($scsscolor[1]) && str_starts_with((string)$scsscolor[1], '#')) {
if (str_starts_with((string)$scsscolor[0], '$')) {
$colors[$scsscolor[0]] = $scsscolor[1];
}
if ( str_starts_with((string)$customvariables, '$') && GeneralUtility::inList($defaultUtilColorsList, $scsscolor[0]) ) {
$scsscolor = GeneralUtility::trimExplode(':', $customvariables);


$customScssArr[$scsscolor[0]] = $scsscolor[1];
}
}
if (is_array($utilColors)) {
foreach($utilColors as $key=>$utiColor) {
if ( !empty($utilityColors[$key]) && str_starts_with((string)$utiColor, '$') ) {
$utilityColors[$key] = $colors[$utiColor];
}
foreach( $customScssArr as $key=>$customvariables ) {
if (str_starts_with((string)$customvariables, '$')) {
if ($customScssArr[$customvariables])
$utilityColors[$key] = $customScssArr[$customvariables];
} elseif ( str_starts_with((string)$customvariables, '#') ) {
if ($customvariables)
$utilityColors[$key] = $customvariables;
}
}
}

$variablesSCSS = 'fileadmin/T3SB/Resources/Public/Contrib/Bootstrap/scss/_variables.scss';
$variablesSCSS = GeneralUtility::getFileAbsFileName($variablesSCSS);
$variablesSCSS = GeneralUtility::getURL($variablesSCSS);
$defaultUtilityColors = [];
$defaultcolors = [];

foreach ( GeneralUtility::trimExplode(';', $variablesSCSS) as $defaultVariables) {
if (!empty($variablesSCSS)) {
foreach ( GeneralUtility::trimExplode(';', $variablesSCSS) as $defaultVariables) {
$defaultScssColor = GeneralUtility::trimExplode(':', $defaultVariables);
if ( str_starts_with((string)$defaultVariables, '$') && GeneralUtility::inList($defaultUtilColorsList, $defaultScssColor[0])
&& ( str_starts_with((string)$defaultScssColor[1], '$') || str_starts_with((string)$defaultScssColor[1], '#') ) ) {
$scsscolor = GeneralUtility::trimExplode(':', $defaultVariables);

$defaultScssColor = GeneralUtility::trimExplode(':', $defaultVariables);
if (!empty($defaultScssColor[1]) && GeneralUtility::inList($defaultUtilColorsList, trim($defaultScssColor[0]))) {
if ( str_starts_with((string)$defaultScssColor[1], '$')) {
// variable has variable
$defaultUtilColors[$defaultScssColor[0]] = trim(rtrim($defaultScssColor[1], '!default'));
} elseif (str_starts_with((string)$defaultScssColor[1], '#')) {
if (str_starts_with((string)$defaultScssColor[0], '$')) {
$defaultcolors[$defaultScssColor[0]] = trim(rtrim($defaultScssColor[1], '!default'));
}

$defaultUtilColors[$scsscolor[0]] = substr($scsscolor[1], 0, -9);
}
}
}

if (is_array($defaultUtilColors)) {
foreach($defaultUtilColors as $key=>$defaultUtiColor) {
$defaultUtilityColors[$key] = $defaultcolors[$defaultUtiColor];
foreach( $defaultUtilColors as $key=>$customvariables ) {
if (str_starts_with((string)$customvariables, '$')) {
if ($customScssArr[$customvariables])
$defaultUtilityColors[$key] = $customScssArr[$customvariables];
} elseif ( str_starts_with((string)$customvariables, '#') ) {
if ($customvariables)
$defaultUtilityColors[$key] = $customvariables;
}
}
}
if ( is_array($utilityColors) && is_array($defaultUtilityColors) ) {

if ( is_array($utilityColors) && is_array($colors) ) {
$colorArr = array_merge($defaultUtilityColors, $defaultcolors, $utilityColors, $colors);
ksort($colorArr);
return $colorArr;
if ( !empty($utilityColors) ) {
$colorArr = array_merge($defaultUtilityColors, $utilityColors);
ksort($colorArr);
return $colorArr;
} else {
ksort($defaultUtilityColors);
return $defaultUtilityColors;
}
} else {
return [];
}
Expand Down
7 changes: 4 additions & 3 deletions Classes/Utility/ResponsiveImagesUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ public function createPictureTag(

$webpIsLoaded = ExtensionManagementUtility::isLoaded('webp');



// Deal with file formats that can't be cropped separately
if ($this->hasIgnoredFileExtension($originalImage, $ignoreFileExtensions)) {
return $this->createSimpleImageTag(
Expand Down Expand Up @@ -136,6 +134,7 @@ public function createPictureTag(
$fallbackTag->addAttribute('sizes', sprintf($lastBreakpoint['sizes'], $referenceWidth));
}
} else {

// Breakpoint can't be used as fallback
if ($lastBreakpoint) {
array_push($breakpoints, $lastBreakpoint);
Expand Down Expand Up @@ -240,7 +239,7 @@ 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');

Expand Down Expand Up @@ -390,10 +389,12 @@ public function generateSrcsetImages(
$srcset = GeneralUtility::trimExplode(',', $srcset);
}


$images = [];
foreach ($srcset as $widthDescriptor) {
// Determine image width
$srcsetMode = substr($widthDescriptor, -1);

switch ($srcsetMode) {
case 'x':
$candidateWidth = (int) ($defaultWidth * (float) substr($widthDescriptor, 0, -1));
Expand Down
12 changes: 4 additions & 8 deletions Classes/ViewHelpers/MediaViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ protected function renderImageTag(FileInterface $image, $width, $height, $fileEx

$cropVariantCollection = CropVariantCollection::create((string)$cropString);
$cropArea = $cropVariantCollection->getCropArea($cropVariant);

if ( $this->arguments['ratio'] ) {
$m = $cropArea->getHeight() / $cropArea->getWidth();
$height = ceil((float)$height * (float)$m);
Expand Down Expand Up @@ -290,16 +289,13 @@ protected function getCropString($image, $cropString)
$cropedWidth = $image->getProperties()['width'] * $cropObject->$cropVariant->cropArea->width;
$cropedHeight = $image->getProperties()['height'] * $cropObject->$cropVariant->cropArea->height;
$rArr = explode(':',$this->arguments['ratio']);

if ($cropVariant == 'mobile') {
$rArr[0] = '16';
$rArr[1] = '9';
} else {
if ( $this->arguments['shift'] ) {
$shift = $this->arguments['shift'] > 0 ? $cropObject->$cropVariant->cropArea->y + $this->arguments['shift']
: $cropObject->$cropVariant->cropArea->y - ($this->arguments['shift'] * -1);
$cropObject->$cropVariant->cropArea->y = $shift;
}
} elseif ( $this->arguments['shift'] ) {
$shift = $this->arguments['shift'] > 0 ? $cropObject->$cropVariant->cropArea->y + $this->arguments['shift']
: $cropObject->$cropVariant->cropArea->y - ($this->arguments['shift'] * -1);
$cropObject->$cropVariant->cropArea->y = $shift;
}

if ( $rArr[0] > $rArr[1] ) {
Expand Down
1 change: 0 additions & 1 deletion Classes/Wrapper/Modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class Modal implements SingletonInterface
*/
public function getProcessedData(array $processedData, array $flexconf): array
{

$processedData['modal']['animation'] = $flexconf['animation'];
$processedData['modal']['size'] = $flexconf['size'];
$processedData['modal']['button'] = $flexconf['button'];
Expand Down
2 changes: 2 additions & 0 deletions Configuration/FlexForms/Container/Modal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
<numIndex index="1">modal-lg</numIndex></numIndex>
<numIndex index="2" type="array"><numIndex index="0">LLL:EXT:t3sbootstrap/Resources/Private/Language/locallang_be.xlf:small</numIndex>
<numIndex index="1">modal-sm</numIndex></numIndex>
<numIndex index="2" type="array"><numIndex index="0">Fullscreen</numIndex>
<numIndex index="1">modal-fullscreen</numIndex></numIndex>
</items>
<default>default</default>
</config>
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TSConfig/CKEditor.tsconfig
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ RTE {
telephone.properties {
class.default =
}
properties.class.allowedClasses = phone-link, fax-link, external-link, internal-link, email-link, download-link, btn, btn btn-primary, btn btn-secondary, btn btn-success, btn btn-danger, btn btn-warning, btn btn-info, btn btn-light, btn btn-dark, js-scroll-trigger, text-primary, text-secondary, text-success, text-danger, text-warning, text-info,text-light, text-light bg-dark, text-dark, text-muted, text-white, text-white bg-dark, stretched-link
properties.class.allowedClasses = phone-link, fax-link, external-link, internal-link, email-link, download-link, btn, btn btn-primary, btn btn-secondary, btn btn-success, btn btn-danger, btn btn-warning, btn btn-info, btn btn-light, btn btn-dark, js-scroll-trigger, text-primary, text-secondary, text-success, text-danger, text-warning, text-info,text-light, text-light bg-dark, text-dark, text-muted, text-white, text-white bg-dark, stretched-link, link-primary, link-secondary, link-success, link-primary, link-secondary, link-success, link-danger, link-warning, link-info, link-light, link-darklink, link-danger, link-warning, link-info, link-light, link-dark
queryParametersSelector.enabled = 0

}
Expand Down
6 changes: 3 additions & 3 deletions Contrib/scssphp/bin/pscss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use ScssPhp\ScssPhp\Parser;
use ScssPhp\ScssPhp\Version;

$style = null;
$loadPaths = [];
$loadPaths = null;
$dumpTree = false;
$inputFile = null;
$changeDir = false;
Expand Down Expand Up @@ -148,7 +148,7 @@ EOT;
$value = parseArgument($i, array('-I', '--load-path'));

if (isset($value)) {
$loadPaths[] = $value;
$loadPaths = $value;
continue;
}

Expand Down Expand Up @@ -188,7 +188,7 @@ if ($dumpTree) {
$scss = new Compiler();

if ($loadPaths) {
$scss->setImportPaths($loadPaths);
$scss->setImportPaths(explode(PATH_SEPARATOR, $loadPaths));
}

if ($style) {
Expand Down
19 changes: 0 additions & 19 deletions Contrib/scssphp/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"sass/sass-spec": "*",
"squizlabs/php_codesniffer": "~3.5",
"symfony/phpunit-bridge": "^5.1",
"thoughtbot/bourbon": "^7.0",
"twbs/bootstrap": "~5.0",
"twbs/bootstrap4": "4.6.0",
"zurb/foundation": "~6.5"
Expand All @@ -64,24 +63,6 @@
}
}
},
{
"type": "package",
"package": {
"name": "thoughtbot/bourbon",
"version": "v7.0.0",
"source": {
"type": "git",
"url": "https://github.com/thoughtbot/bourbon.git",
"reference": "fbe338ee6807e7f7aa996d82c8a16f248bb149b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thoughtbot/bourbon/zipball/fbe338ee6807e7f7aa996d82c8a16f248bb149b3",
"reference": "fbe338ee6807e7f7aa996d82c8a16f248bb149b3",
"shasum": ""
}
}
},
{
"type": "package",
"package": {
Expand Down
Loading

0 comments on commit 076dcfc

Please sign in to comment.