Skip to content

Commit

Permalink
v4.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
t3solution committed Apr 27, 2020
1 parent 7fb611a commit 5128394
Show file tree
Hide file tree
Showing 185 changed files with 5,077 additions and 6,048 deletions.
54 changes: 37 additions & 17 deletions Classes/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
*/

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\RootlineUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Backend\View\BackendTemplateView;
use TYPO3\CMS\Frontend\Page\PageRepository;

/**
* ConfigController
Expand All @@ -44,6 +42,12 @@ class ConfigController extends ActionController
*/
protected $defaultViewObjectName = BackendTemplateView::class;

/**
* TYPO3 version
*
* @var int
*/
protected $version;


/**
Expand All @@ -57,18 +61,32 @@ public function injectConfigRepository(\T3SBS\T3sbootstrap\Domain\Repository\Con
}


public function initializeAction()
{
if (version_compare(TYPO3_branch, '10.0', '>=')) {
$this->version = 10;
} else {
$this->version = 9;
}
}


/**
* action list
*
* @return void
*/
public function listAction()
{

$isSiteroot = self::isSiteroot();

if ( $isSiteroot ) {
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);

if ($this->version == 10) {
$pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Domain\Repository\PageRepository::class);
} else {
$pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
}

$configRepository = $this->configRepository->findAll();

Expand All @@ -91,23 +109,17 @@ public function listAction()
$assignedOptions['customScss'] = FALSE;
$assignedOptions['scss'] = '';

if ( (int)$this->settings['customScss'] === 1 ) {
if ( (int)$this->settings['customScss'] === 1 && (int)$this->settings['wsScss'] === 1 ) {

$customScss = self::getCustomScss('custom-variables');
$assignedOptions['custom-variables'] = $customScss['custom-variables'];

$customScss = self::getCustomScss('custom');
$assignedOptions['custom'] = $customScss['custom'];
$assignedOptions['customScss'] = $customScss['customScss'];

}

if ( ExtensionManagementUtility::isLoaded('ws_scss') ) {
$assignedOptions['compiler'] = TRUE;
} else {
$assignedOptions['compiler'] = FALSE;
$assignedOptions['config'] = FALSE;
}
$assignedOptions['version'] = $this->version;

$this->view->assignMultiple($assignedOptions);
}
Expand All @@ -131,6 +143,7 @@ public function newAction()
$rootLineArray = GeneralUtility::makeInstance(RootlineUtility::class, (int)$_GET['id'])->get();

// unset current page
if (count($rootLineArray) > 1)
unset($rootLineArray[count($rootLineArray)-1]);

foreach ($rootLineArray as $rootline) {
Expand Down Expand Up @@ -179,6 +192,7 @@ public function newAction()
}

$assignedOptions['pid'] = (int)$_GET['id'];
$assignedOptions['version'] = $this->version;

$this->view->assignMultiple($assignedOptions);
}
Expand All @@ -192,7 +206,7 @@ public function newAction()
*/
public function createAction(\T3SBS\T3sbootstrap\Domain\Model\Config $newConfig)
{
$this->addFlashMessage('The new configuration was created.', '', AbstractMessage::WARNING);
$this->addFlashMessage('The new configuration was created.');

if ( self::isSiteroot() ) {
$homepageUid = (int)$_GET['id'];
Expand All @@ -219,7 +233,6 @@ public function createAction(\T3SBS\T3sbootstrap\Domain\Model\Config $newConfig)
*/
public function editAction(\T3SBS\T3sbootstrap\Domain\Model\Config $config)
{

$assignedOptions = self::getFieldsOptions();
$assignedOptions['config'] = $config;
$assignedOptions['pid'] = (int)$_GET['id'];
Expand Down Expand Up @@ -248,6 +261,8 @@ public function editAction(\T3SBS\T3sbootstrap\Domain\Model\Config $config)
$assignedOptions['compare'] = $compare;
}

$assignedOptions['version'] = $this->version;

$this->view->assignMultiple($assignedOptions);
}

Expand All @@ -260,7 +275,7 @@ public function editAction(\T3SBS\T3sbootstrap\Domain\Model\Config $config)
*/
public function updateAction(\T3SBS\T3sbootstrap\Domain\Model\Config $config)
{
$this->addFlashMessage('The configuration was updated.', '', AbstractMessage::WARNING);
$this->addFlashMessage('The configuration was updated.');

if ( self::isSiteroot() ) {
$homepageUid = (int)$_GET['id'];
Expand All @@ -286,7 +301,7 @@ public function updateAction(\T3SBS\T3sbootstrap\Domain\Model\Config $config)
*/
public function deleteAction(\T3SBS\T3sbootstrap\Domain\Model\Config $config)
{
$this->addFlashMessage('The object was deleted.', '', AbstractMessage::WARNING);
$this->addFlashMessage('The object was deleted.');
$this->configRepository->remove($config);
$this->redirect('list');
}
Expand Down Expand Up @@ -466,7 +481,12 @@ public function getNewConfig(\T3SBS\T3sbootstrap\Domain\Model\Config $rootConfig
*/
protected function isSiteroot()
{
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
if ($this->version == 10) {
$pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Domain\Repository\PageRepository::class);
} else {
$pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
}

$page = $pageRepository->getPage((int)$_GET['id']);

if ( $page['is_siteroot'] ) {
Expand Down
18 changes: 12 additions & 6 deletions Classes/DataProcessing/BootstrapProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$style = $styleHelper->getBgColor($processedData['data']);
$processedData['style'] = $processedData['style'] ? $processedData['style'].' '.$style : $style;


##############################################################################################################################################
/**
* CType: Gridelements
Expand All @@ -74,7 +75,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
* Background Wrapper
*/
if ( $processedData['data']['tx_gridelements_backend_layout'] == 'background_wrapper') {
$processedData = $wrapperHelper->getBackgroundWrapper($processedData, $flexconf);
$processedData = $wrapperHelper->getBackgroundWrapper($processedData, $flexconf, $contentObjectConfiguration['settings.']['cdnEnable']);
}

/**
Expand Down Expand Up @@ -354,9 +355,9 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
if ($processedData['data']['assets'] || $processedData['data']['image'] || $processedData['data']['media']) {
$imageorient = $processedData['data']['imageorient'];
$galleryUtility = GeneralUtility::makeInstance(GalleryHelper::class);
// Gallery row with 25, 50, 75 or 100%
$processedData = $galleryUtility->getGalleryRowWidth( $processedData, $imageorient );
$processedData = $galleryUtility->getGalleryClasses( $processedData, $imageorient );
// Gallery row with 25, 33, 50, 66, 75 or 100%
$processedData = $galleryUtility->getGalleryRowWidth( $processedData );
$processedData = $galleryUtility->getGalleryClasses( $processedData );
}
} else {
if ( $processedData['data']['assets'] || $processedData['data']['image'] || $processedData['data']['media'] ) {
Expand All @@ -380,13 +381,12 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
}
}


# if media
if ( $processedData['data']['assets'] || $processedData['data']['image'] || $processedData['data']['media'] ) {

$processedData['addmedia']['imgclass'] = $processedData['addmedia']['imgclass'] ?: 'img-fluid';
$processedData['addmedia']['imgclass'] .= $processedData['data']['imageborder'] ? ' border' :'';
$processedData['addmedia']['imgclass'] .= $processedData['data']['tx_t3sbootstrap_bordercolor']
$processedData['addmedia']['imgclass'] .= $processedData['data']['tx_t3sbootstrap_bordercolor'] && $processedData['data']['imageborder']
? ' border-'.$processedData['data']['tx_t3sbootstrap_bordercolor'] : '';
// lazyload
if ( $extConf['lazyLoad'] ) {
Expand All @@ -412,6 +412,12 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$processedData['containerPost'] = '</div>';
$processedData['container'] = $container;
}
if ($processedData['be_layout'] == 'OneCol' && !$container) {
$pageContainer = self::getFrontendController()->page['tx_t3sbootstrap_container'] ? TRUE : FALSE;
if (!$pageContainer && !$processedData['data']['tx_gridelements_container']) {
$processedData['containerError'] = TRUE;
}
}

// default header type
switch ( $processedData['data']['CType'] ) {
Expand Down
3 changes: 2 additions & 1 deletion Classes/DataProcessing/CardProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu

if ($flexconf['button']['enable']) {
$cardData['button']['link'] = $processedData['data']['header_link'];
$processedData['data']['header_link'] = '';
$processedData['data']['header_link'] = '';
}
$cardData['dimensions']['width'] = $processedData['data']['imagewidth'];
$cardData['dimensions']['height'] = $processedData['data']['imageheight'];
Expand Down Expand Up @@ -152,6 +152,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$processedData['addmedia']['imgclass'] = $cardData['image']['class'];
$processedData['addmedia']['figureclass'] = ' text-center';

// slider
if ( $parentflexconf['card_wrapper'] == 'slider' ) {
$processedData['cardSliderPre'] = '<div class="carousel-item col-md-4">';
$processedData['cardSliderPost'] = '</div>';
Expand Down
6 changes: 5 additions & 1 deletion Classes/DataProcessing/CommaSeparatedValueProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
(int)$maximumColumns
);


##t3sb
$tableClass = '';
$croppedTable = [];

if (is_array($processedData['table'])) {
foreach ($processedData['table'] as $key=>$table) {
if ( \TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($table[count($table)-1], 'ç') ) {
Expand All @@ -118,7 +122,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
}
}
}
if (is_array($croppedTable)) {
if (!empty($croppedTable)) {
$processedData['table'] = $croppedTable;
}
}
Expand Down
33 changes: 23 additions & 10 deletions Classes/DataProcessing/ConfigProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;
use TYPO3\CMS\Frontend\Page\PageRepository;
use TYPO3\CMS\Frontend\Resource\FilePathSanitizer;
use T3SBS\T3sbootstrap\Utility\BackgroundImageUtility;

use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;

class ConfigProcessor implements DataProcessorInterface
Expand Down Expand Up @@ -60,7 +58,6 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu

$frontendController = self::getFrontendController();


// the table to query
$tableName = 'tx_t3sbootstrap_domain_model_config';
$processorConfiguration['pidInList'] = $frontendController->id;
Expand Down Expand Up @@ -148,7 +145,12 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$currentPage = $frontendController->page;
$smallColumnsCurrent = (int)$currentPage['tx_t3sbootstrap_smallColumns'];

$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
if (version_compare(TYPO3_branch, '10.0', '>=')) {
$pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Domain\Repository\PageRepository::class);
} else {
$pageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
}

$rootlinePage = $pageRepository->getPage($frontendController->rootLine[0]['uid']);

$smallColumnsRootline = (int)$rootlinePage['tx_t3sbootstrap_smallColumns'];
Expand Down Expand Up @@ -519,14 +521,25 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$pageRenderer->addJsFooterFile($jsFooterFile);
}
if ( $animateCSS ) {
$cssFile = 'EXT:t3sbootstrap/Resources/Public/Contrib/Animate/animate.min.css';
$cssFile = GeneralUtility::makeInstance(FilePathSanitizer::class)->sanitize($cssFile);
$pageRenderer->addCssFile($cssFile);
if ($processorConfiguration['cdnEnable']) {
$cssFile = 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/'.$processorConfiguration['cdnAnimate'].'/animate.min.css';
$pageRenderer->addCssFile($cssFile);
} else {
$cssFile = 'fileadmin/T3SB/Resources/Public/CSS/animate.min.css';
$cssFile = GeneralUtility::makeInstance(FilePathSanitizer::class)->sanitize($cssFile);
$pageRenderer->addCssFile($cssFile);
}
}
if ( $repeatCSS ) {
$jsFooterFile = 'EXT:t3sbootstrap/Resources/Public/Contrib/Animate/jquery.viewportchecker.min.js';
$jsFooterFile = GeneralUtility::makeInstance(FilePathSanitizer::class)->sanitize($jsFooterFile);
$pageRenderer->addJsFooterFile($jsFooterFile);

if ($processorConfiguration['cdnEnable']) {
$jsFooterFile = 'https://cdnjs.cloudflare.com/ajax/libs/jQuery-viewport-checker/'.$processorConfiguration['cdnViewportchecker'].'/jquery.viewportchecker.min.js';
$pageRenderer->addJsFooterFile($jsFooterFile);
} else {
$jsFooterFile = 'fileadmin/T3SB/Resources/Public/JS/jquery.viewportchecker.min.js';
$jsFooterFile = GeneralUtility::makeInstance(FilePathSanitizer::class)->sanitize($jsFooterFile);
$pageRenderer->addJsFooterFile($jsFooterFile);
}

$animateCssInlineJs = $processorConfiguration['animateCssInlineJs'] ?: "classToAdd: 'bt_visible',classToRemove: 'bt_hidden',offset: 0";
if ( $animateCssInlineJs ) {
Expand Down
Loading

0 comments on commit 5128394

Please sign in to comment.