Skip to content

Commit

Permalink
Merge pull request #435 from t3solution/5.3.21
Browse files Browse the repository at this point in the history
See release notes at https://www.t3sbootstrap.de/log
  • Loading branch information
t3solution authored Feb 17, 2025
2 parents 62d91ec + dbfd7fa commit fdc2529
Show file tree
Hide file tree
Showing 90 changed files with 3,397 additions and 436 deletions.
77 changes: 77 additions & 0 deletions Classes/Command/ImageToTextmedia.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

declare(strict_types=1);

namespace T3SBS\T3sbootstrap\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;

/*
* This file is part of the TYPO3 extension t3sbootstrap.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
class ImageToTextmedia extends CommandBase
{
/**
* Defines the allowed options for this command
*
* @inheritdoc
*/
protected function configure()
{
$this->setDescription('Migrate CType image to textmedia');
}


/**
* Update all records
*
* @inheritdoc
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
$contentQueryBuilder = $connectionPool->getQueryBuilderForTable('tt_content');
$images = $contentQueryBuilder
->select('uid', 'image')
->from('tt_content')
->where(
$contentQueryBuilder->expr()->eq('CType', $contentQueryBuilder->createNamedParameter('image'))
)
->executeQuery()
->fetchAllAssociative();

$sysfileQueryBuilder = $connectionPool->getQueryBuilderForTable('sys_file_reference');

foreach ($images as $image) {

$contentQueryBuilder
->update('tt_content')
->where(
$contentQueryBuilder->expr()->eq('uid', $contentQueryBuilder->createNamedParameter($image['uid'], Connection::PARAM_INT)),
)
->set('assets', $image['image'])
->set('image', 0)
->set('CType', 'textmedia')
->executeStatement();

$sysfileQueryBuilder
->update('sys_file_reference')
->where(
$sysfileQueryBuilder->expr()->eq('uid_foreign', $sysfileQueryBuilder->createNamedParameter($image['uid'], Connection::PARAM_INT)),
)
->set('fieldname', 'assets')
->executeStatement();
}

return Command::SUCCESS;
}

}
66 changes: 66 additions & 0 deletions Classes/Command/TextToTextmedia.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

declare(strict_types=1);

namespace T3SBS\T3sbootstrap\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;

/*
* This file is part of the TYPO3 extension t3sbootstrap.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
class TextToTextmedia extends CommandBase
{
/**
* Defines the allowed options for this command
*
* @inheritdoc
*/
protected function configure()
{
$this->setDescription('Migrate CType text to textmedia');
}


/**
* Update all records
*
* @inheritdoc
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
$contentQueryBuilder = $connectionPool->getQueryBuilderForTable('tt_content');
$texts = $contentQueryBuilder
->select('uid',)
->from('tt_content')
->where(
$contentQueryBuilder->expr()->eq('CType', $contentQueryBuilder->createNamedParameter('text'))
)
->executeQuery()
->fetchAllAssociative();


foreach ($texts as $text) {

$contentQueryBuilder
->update('tt_content')
->where(
$contentQueryBuilder->expr()->eq('uid', $contentQueryBuilder->createNamedParameter($text['uid'], Connection::PARAM_INT)),
)
->set('CType', 'textmedia')
->executeStatement();
}

return Command::SUCCESS;
}

}
77 changes: 77 additions & 0 deletions Classes/Command/TextpicToTextmedia.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

declare(strict_types=1);

namespace T3SBS\T3sbootstrap\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;

/*
* This file is part of the TYPO3 extension t3sbootstrap.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
class TextpicToTextmedia extends CommandBase
{
/**
* Defines the allowed options for this command
*
* @inheritdoc
*/
protected function configure()
{
$this->setDescription('Migrate CType textpic to textmedia');
}


/**
* Update all records
*
* @inheritdoc
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
$contentQueryBuilder = $connectionPool->getQueryBuilderForTable('tt_content');
$textpics = $contentQueryBuilder
->select('uid', 'image')
->from('tt_content')
->where(
$contentQueryBuilder->expr()->eq('CType', $contentQueryBuilder->createNamedParameter('textpic'))
)
->executeQuery()
->fetchAllAssociative();

$sysfileQueryBuilder = $connectionPool->getQueryBuilderForTable('sys_file_reference');

foreach ($textpics as $textpic) {

$contentQueryBuilder
->update('tt_content')
->where(
$contentQueryBuilder->expr()->eq('uid', $contentQueryBuilder->createNamedParameter($textpic['uid'], Connection::PARAM_INT)),
)
->set('assets', $textpic['image'])
->set('image', 0)
->set('CType', 'textmedia')
->executeStatement();

$sysfileQueryBuilder
->update('sys_file_reference')
->where(
$sysfileQueryBuilder->expr()->eq('uid_foreign', $sysfileQueryBuilder->createNamedParameter($textpic['uid'], Connection::PARAM_INT)),
)
->set('fieldname', 'assets')
->executeStatement();
}

return Command::SUCCESS;
}

}
2 changes: 1 addition & 1 deletion Classes/Components/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function getProcessedData(array $processedData, array $flexconf, array $p
// addmedia
$processedData['addmedia']['imgclass'] = $cardData['image']['class'];
$processedData['addmedia']['imgclass'] .= !empty($flexconf['horizontal']) ? ' rounded-start' : '';
$processedData['addmedia']['figureclass'] = ' text-center';
$processedData['addmedia']['figureclass'] = ' text-center mx-auto';
$processedData['addmedia']['figureclass'] .= !empty($flexconf['horizontal']) ? ' d-block' : '';

if (!empty($cardData['square']['enable'])) {
Expand Down
21 changes: 11 additions & 10 deletions Classes/Components/Carousel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
use TYPO3\CMS\Core\Resource\FileRepository;

/*
* This file is part of the TYPO3 extension t3sbootstrap.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
* This file is part of the TYPO3 extension t3sbootstrap.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
class Carousel implements SingletonInterface
{

Expand All @@ -23,7 +23,7 @@ class Carousel implements SingletonInterface
public function getProcessedData(array $processedData, array $flexconf, array $parentflexconf, string $animateCss): array
{
$innerCaptionStyle = '';
$processedData['dimensions']['width'] = $parentflexconf['width'] ?: '';
$processedData['dimensions']['width'] = !empty($parentflexconf['width']) ? $parentflexconf['width'] : '';
$processedData['carouselLink'] = $parentflexconf['link'] ?? '';
$processedData['mobileNoRatio'] = $parentflexconf['mobileNoRatio'] ?? '';

Expand Down Expand Up @@ -99,8 +99,9 @@ public function getProcessedData(array $processedData, array $flexconf, array $p
$muted = !empty($flexconf['muted']) ? $flexconf['muted'] : FALSE;
$processedData['muted'] = !empty($file->getProperties()['autoplay']) ? TRUE : $muted;
$processedData['playsinline'] = !empty($flexconf['playsinline']) ? TRUE : FALSE;
$btnlink = !empty($parentflexconf['link']) && $parentflexconf['link'] == 'button' ? TRUE : FALSE;
if ($processedData['data']['header'] || $processedData['data']['bodytext']
|| ( $processedData['data']['header_link'] && $parentflexconf['link'] == 'button') ) {
|| ( $processedData['data']['header_link'] && $btnlink) ) {
$processedData['controls'] = 0;
} else {
$processedData['controls'] = !empty($flexconf['controls']) ? $flexconf['controls'] : 0;
Expand All @@ -110,7 +111,7 @@ public function getProcessedData(array $processedData, array $flexconf, array $p

$processedData['ratioCalc'] = '';

if ($parentflexconf['ratio']) {
if (!empty($parentflexconf['ratio'])) {
$ratioArr = explode(':', $parentflexconf['ratio']);
$x = str_replace(':', 'x', $parentflexconf['ratio']);
$y = $ratioArr[1].' / '.$ratioArr[0].' * 100%';
Expand All @@ -136,7 +137,7 @@ public function getProcessedData(array $processedData, array $flexconf, array $p
}
$processedData['zoom'] = $parentflexconf['zoom'] ?? '';
$processedData['ratio'] = '';
if ($parentflexconf['ratio']) {
if (!empty($parentflexconf['ratio'])) {
$carouselRatioArr = explode(':', (string) $parentflexconf['ratio']);
if ( !empty($carouselRatioArr[0]) ) {
$processedData['ratio'] = $parentflexconf['ratio'];
Expand Down Expand Up @@ -195,4 +196,4 @@ public function getCarouselCaptionStyle( $flexconf, $animate ): string
return $style;
}

}
}
6 changes: 3 additions & 3 deletions Classes/Components/Toast.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class Toast implements SingletonInterface
*/
public function getProcessedData(array $processedData, array $flexconf): array
{
$processedData['animation'] = $flexconf['animation'] ? 'true' : 'false';
$processedData['autohide'] = $flexconf['autohide'] ? 'true' : 'false';
$processedData['delay'] = $flexconf['delay'];
$processedData['animation'] = !empty($flexconf['animation']) ? 'true' : 'false';
$processedData['autohide'] = !empty($flexconf['autohide']) ? 'true' : 'false';
$processedData['delay'] = !empty($flexconf['delay']) ? $flexconf['delay'] : '';
$processedData['style'] .= !empty($flexconf['toastwidth']) ? ' width:'.$flexconf['toastwidth'].'px;' : '';
if (!empty($flexconf['placement']) && str_starts_with($flexconf['placement'], 'top-0')) {
$processedData['placement'] = ' '.str_replace('top-0', 'top-70', $flexconf['placement']);
Expand Down
5 changes: 0 additions & 5 deletions Classes/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ public function listAction(
}
}

$assignedOptions['webpIsLoaded'] = false;
if (ExtensionManagementUtility::isLoaded('webp')) {
$assignedOptions['webpIsLoaded'] = true;
}

$new_raster = GeneralUtility::getFileAbsFileName('fileadmin/T3SB/Resources/Public/Images/raster.png');
if ( !file_exists($new_raster) ) {
$folder = GeneralUtility::getFileAbsFileName('fileadmin/T3SB/Resources/Public/Images/');
Expand Down
41 changes: 18 additions & 23 deletions Classes/DataProcessing/BootstrapProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function process(
array $processedData
): array
{

if ( empty($processedData['data']['CType']) ) {
return $processedData;
}
Expand All @@ -98,13 +99,15 @@ public function process(
$flexformHelper = GeneralUtility::makeInstance(FlexformHelper::class);
$flexconf = $flexformHelper->addMissingElements($flexconf, $cType, $t3sbsElement);

if ($parentUid) {
if (!empty($parentUid)) {
$parentData = BackendUtility::getRecord('tt_content', $parentUid, 'uid, CType, tx_t3sbootstrap_flexform, tx_container_parent');
$parentCType = $parentData['CType'];
$parentflexconf = $flexFormService->convertFlexFormContentToArray($parentData['tx_t3sbootstrap_flexform']);
if (is_string($parentCType)) {
$parentflexconf = $flexformHelper->addMissingElements($parentflexconf, $parentCType, $t3sbsElement);
}
if (!empty($parentData['tx_t3sbootstrap_flexform'])) {
$parentflexconf = $flexFormService->convertFlexFormContentToArray($parentData['tx_t3sbootstrap_flexform']);
if (is_string($parentCType)) {
$parentflexconf = $flexformHelper->addMissingElements($parentflexconf, $parentCType, $t3sbsElement);
}
}
$parentContainer = $parentData['tx_container_parent'];
}

Expand Down Expand Up @@ -427,18 +430,19 @@ public function process(
// chapter
if ( !empty($extConf['chapter']) && !empty($processedData['data']['tx_t3sbootstrap_chapter']) ) {
$processedData = self::getChapterIndex($processedData, $request);

if ( $processedData['data']['tx_t3sbootstrap_chapter'] === '1' ) {
$chapter = ' main-chapter';
$chapter = $trimClass.' main-chapter';
} else {
$chapter = ' sub-chapter';
}

$trimClass .= $chapter.' chapter-indent';
$chapter = $trimClass.' sub-chapter';
}
$chapterClass = $chapter.' chapter-indent';
$processedData['classAttr'] = !empty($chapterClass) ? ' class="'.$chapterClass.'"' : '';
$processedData['trimClass'] = !empty($chapterClass) ? $chapterClass : '';
} else {
$processedData['classAttr'] = !empty($trimClass) ? ' class="'.$trimClass.'"' : '';
$processedData['trimClass'] = $trimClass;
}

$processedData['classAttr'] = !empty($trimClass) ? ' class="'.$trimClass.'"' : '';

return $processedData;
}

Expand Down Expand Up @@ -514,16 +518,7 @@ function getChapterIndex(array $processedData, ServerRequestInterface $request):

$uid = $processedData['data']['uid'];

if ( !empty( $erg[$uid]) ) {
if ( $processedData['data']['tx_t3sbootstrap_chapter'] === '1') {
$class = 'chapter main-chapter';
} else {
$class = 'chapter sub-chapter';
}
}

$processedData['data']['chapter'] ='<span class="position-relative">
<span class="chapter-indexer position-absolute">' .$erg[$uid]['index']. '</span></span>';
$processedData['chapter-index'] = $erg[$uid]['index'];

return $processedData;
}
Expand Down
Loading

0 comments on commit fdc2529

Please sign in to comment.