Skip to content

Commit

Permalink
Merge pull request #97 from t3solution/4.5.6
Browse files Browse the repository at this point in the history
v4.5.6
  • Loading branch information
t3solution authored Mar 21, 2021
2 parents a88f084 + 4424024 commit 6c7c270
Show file tree
Hide file tree
Showing 41 changed files with 732 additions and 199 deletions.
2 changes: 1 addition & 1 deletion Classes/Command/CustomScss.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('t3sbootstrap');

if ( $settings['customScss'] && array_key_exists('customScss', $extConf)
&& $extConf['customScss'] === '1' && ExtensionManagementUtility::isLoaded('ws_scss' ) ) {
&& $extConf['customScss'] === '1' && ExtensionManagementUtility::isLoaded('ws_scss') ) {

# get the Boostrap SCSS-Files
$scssList = '_alert.scss, _badge.scss, _breadcrumb.scss, _button-group.scss, _buttons.scss, _card.scss, _carousel.scss, _close.scss, _code.scss, _custom-forms.scss, _dropdown.scss, _forms.scss, _functions.scss, _grid.scss, _images.scss, _input-group.scss, _jumbotron.scss, _list-group.scss, _media.scss, _mixins.scss, _modal.scss, _nav.scss, _navbar.scss, _pagination.scss, _popover.scss, _print.scss, _progress.scss, _reboot.scss, _root.scss, _spinners.scss, _tables.scss, _toasts.scss, _tooltip.scss, _transitions.scss, _type.scss, _utilities.scss, _variables.scss, bootstrap-grid.scss, bootstrap-reboot.scss, bootstrap.scss';
Expand Down
82 changes: 75 additions & 7 deletions Classes/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Backend\View\BackendTemplateView;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Core\Database\QueryGenerator;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Site\Entity\SiteInterface;
use TYPO3\CMS\Core\Routing\SiteMatcher;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Frontend\Resource\FilePathSanitizer;

use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\Query\QueryHelper;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Information\Typo3Version;

/**
* ConfigController
Expand Down Expand Up @@ -88,6 +88,13 @@ class ConfigController extends ActionController
*/
protected $rootConfig;

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


/**
* Inject a configRepository repository to enable DI
Expand All @@ -109,6 +116,18 @@ public function initializeAction()
$this->tcaColumns = $GLOBALS['TCA']['tx_t3sbootstrap_domain_model_config']['columns'];
$this->isAdmin = $GLOBALS['BE_USER']->isAdmin();
$this->rootConfig = $this->configRepository->findOneByPid($this->rootPageId);
$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
$this->version = (int)$typo3Version->getVersion();

$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->loadRequireJsModule(
'TYPO3/CMS/T3sbootstrap/T3sBootstrap',
'function() { console.log("Loaded own module."); }'
);

if ($this->version === 11) {
$pageRenderer->addCssFile('/typo3conf/ext/t3sbootstrap/Resources/Public/Backend/bestyles11.css');
}
}


Expand All @@ -122,9 +141,9 @@ public function initializeAction()
*/
public function listAction($deleted = FALSE, $created = FALSE, $updateSss = FALSE): void
{
if ( $this->isSiteroot ) {
$queryGenerator = GeneralUtility::makeInstance(QueryGenerator::class);
$pidList = $queryGenerator->getTreeList($this->rootPageId, 999999, 0, 1);
if ( $this->isSiteroot && $this->rootPageId ) {

$pidList = $this->getTreeList($this->rootPageId, 999999, 0, '1');

foreach ( $this->configRepository->findAll() as $config ) {
if (GeneralUtility::inList($pidList, $config->getPid())) {
Expand All @@ -139,6 +158,7 @@ public function listAction($deleted = FALSE, $created = FALSE, $updateSss = FALS
$assignedOptions['allConfig'] = $allConfig;
}

$assignedOptions['t3version'] = $this->version;
$assignedOptions['rootConfig'] = $this->rootConfig ? TRUE : FALSE;
$assignedOptions['config'] = $this->configRepository->findOneByPid($this->currentUid);
$assignedOptions['admin'] = $this->isAdmin;
Expand Down Expand Up @@ -234,6 +254,7 @@ public function createAction(\T3SBS\T3sbootstrap\Domain\Model\Config $newConfig)
public function editAction(\T3SBS\T3sbootstrap\Domain\Model\Config $config, $updated = FALSE): void
{
$assignedOptions = self::getFieldsOptions();
$assignedOptions['t3version'] = $this->version;
$assignedOptions['config'] = $config;
$assignedOptions['pid'] = $this->currentUid;
$assignedOptions['admin'] = $this->isAdmin;
Expand Down Expand Up @@ -293,6 +314,7 @@ public function dashboardAction(): void
$assignedOptions['isLoaded']['ws_scss'] = ExtensionManagementUtility::isLoaded('ws_scss');
}

$assignedOptions['t3version'] = $this->version;
$assignedOptions['action'] = 'dashboard';
$assignedOptions['isSiteroot'] = $this->isSiteroot;
$assignedOptions['admin'] = $this->isAdmin;
Expand Down Expand Up @@ -325,6 +347,7 @@ public function constantsAction(): void
}
}

$assignedOptions['t3version'] = $this->version;
$assignedOptions['action'] = 'constants';
$assignedOptions['isSiteroot'] = $this->isSiteroot;
$assignedOptions['admin'] = $this->isAdmin;
Expand Down Expand Up @@ -858,4 +881,49 @@ protected function getCurrentSite(): SiteInterface
}


protected function getTreeList($id, $depth, $begin = 0, $permsClause = ''): string
{
$depth = (int)$depth;
$begin = (int)$begin;
$id = (int)$id;
if ($id < 0) {
$id = abs($id);
}
if ($begin == 0) {
$theList = $id;
} else {
$theList = '';
}
if ($id && $depth > 0) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
$statement = $queryBuilder->select('uid')
->from('pages')
->where(
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)),
$queryBuilder->expr()->eq('sys_language_uid', 0),
QueryHelper::stripLogicalOperatorPrefix($permsClause)
)
->execute();
while ($row = $statement->fetch()) {
if ($begin <= 0) {
$theList .= ',' . $row['uid'];
}
if ($depth > 1) {
$theSubList = $this->getTreeList($row['uid'], $depth - 1, $begin - 1, $permsClause);
if (!empty($theList) && !empty($theSubList) && ($theSubList[0] !== ',')) {
$theList .= ',';
}
$theList .= $theSubList;
}
}
}

return (string)$theList;
}





}
21 changes: 20 additions & 1 deletion Classes/DataProcessing/BootstrapProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
if ( $processedData['data']['CType'] == 'carousel_container' ) {
$processedData = $wrapperHelper->getCarouselContainer($processedData, $flexconf);
$processedData['isTxContainer'] = TRUE;
if ($flexconf['zoom']) {
$processedData['lightBox'] = TRUE;
}
if ( $processorConfiguration['carouselFiles'] ) {
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
$queryBuilder = $connectionPool->getQueryBuilderForTable('tt_content');
Expand Down Expand Up @@ -209,6 +212,13 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$processedData['isTxContainer'] = TRUE;
}

/**
* Lightbox avtive
*/
if ( $processedData['data']['CType'] == 't3sbs_gallery' || $processedData['data']['image_zoom'] ) {
$processedData['lightBox'] = TRUE;
}

/**
* Tabs / Pills
*/
Expand All @@ -233,6 +243,13 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$processedData['isTxContainer'] = TRUE;
}

/**
* Container
*/
if ( $processedData['data']['CType'] == 'container' ) {
$processedData['isTxContainer'] = TRUE;
}

/**
* Button
*/
Expand Down Expand Up @@ -375,7 +392,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$processedData['pageLink'] = TRUE;
} else {
// if current page is selected
if ( self::getFrontendController()->id == $processedData['data']['pid'] ) {
if ( $GLOBALS['TSFE']->id == $processedData['data']['pid'] ) {
$processedData['onlyCurrentPageSelected'] = TRUE;
} else {
$processedData['pageLink'] = TRUE;
Expand Down Expand Up @@ -585,6 +602,8 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$processedData['class'] .= $containerClass ? ' '.$containerClass : '';
}

$processedData['style'] .= ' '.$processedData['data']['tx_t3sbootstrap_extra_style'];

$processedData['style'] = trim($processedData['style']);
$processedData['class'] = trim($processedData['class']);

Expand Down
3 changes: 1 addition & 2 deletions Classes/DataProcessing/LastModifiedProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class LastModifiedProcessor implements DataProcessorInterface
public function process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
{
if ($processorConfiguration['lastModifiedContentElement']) {

$processorConfiguration = [];
$processorConfiguration['pidInList'] = self::getFrontendController()->id;
$processorConfiguration['pidInList'] = $currentId;
$records = $cObj->getRecords('tt_content', $processorConfiguration);

foreach ( $records as $record ) {
Expand Down Expand Up @@ -94,7 +94,6 @@ protected function getRecentlyUpdated($setMaxResults): array
{
$languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language');
$sysLanguageUid = $languageAspect->getContentId() ?: 0;

$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content');
$result = $queryBuilder
->select('uid','pid','header', 'tstamp')
Expand Down
5 changes: 2 additions & 3 deletions Classes/EventListener/AssetRenderer/IsInline.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

use TYPO3\CMS\Core\Page\Event\BeforeJavaScriptsRenderingEvent;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Http\ApplicationType;


class IsInline
{

public function __invoke(BeforeJavaScriptsRenderingEvent $event): void
{

if (TYPO3_MODE === 'BE') {
if (ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend()) {
return;
}

Expand Down Expand Up @@ -83,7 +83,6 @@ public function __invoke(BeforeJavaScriptsRenderingEvent $event): void

foreach ($assetJsInline as $library => $source) {


if ($library == 'lazyload' || $library == 'lazyloadmagnifying' || $library == 'codesnippetJsInline' ) {
$js .= $source['source'] .PHP_EOL;
$event->getAssetCollector()->removeInlineJavaScript($library);
Expand Down
4 changes: 2 additions & 2 deletions Classes/ExpressionLanguage/T3sbConditionFunctionsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use T3SBS\T3sbootstrap\Domain\Repository\ConfigRepository;

use TYPO3\CMS\Core\Http\ApplicationType;

/**
* Class T3sbConditionFunctionsProvider
Expand Down Expand Up @@ -74,7 +74,7 @@ protected function getColPosList(): ExpressionFunction

$result = FALSE;

if ( $_GET['id'] && TYPO3_MODE == 'BE' ) {
if ( $_GET['id'] && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend() ) {

$pid = (int)$_GET['id'];
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
Expand Down
28 changes: 18 additions & 10 deletions Classes/Helper/WrapperHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Page\AssetCollector;
use TYPO3\CMS\Core\Page\PageRenderer;


class WrapperHelper implements SingletonInterface
{
Expand Down Expand Up @@ -110,16 +112,19 @@ public function getBackgroundWrapper($processedData, $flexconf, $cdnEnable=null,
$addFilters.'
});';
}
if ($cssFile)
GeneralUtility::makeInstance(AssetCollector::class)
->addStyleSheet('ytplayercss', $cssFile,[],['priority' => true]);
if ($cssFile) {
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addCssFile($cssFile);
}

if ($jsFooterFile)
GeneralUtility::makeInstance(AssetCollector::class)
->addJavaScript('ytplayerjs', $jsFooterFile);
if ($inlineJS)
GeneralUtility::makeInstance(AssetCollector::class)
->addInlineJavaScript('background-video-'.$processedData['data']['uid'], $inlineJS);



$events = $flexconf;
$events['videoAutoPlay'] = $file->getProperties()['autoplay'];
$events['uid'] = $processedData['data']['uid'];
Expand Down Expand Up @@ -360,12 +365,15 @@ public function getCarouselContainer($processedData, $flexconf): array
$(\'#multiSlider-'.$processedData['data']['uid'].'\').multislider({'.$options.'});';

$block = '#multiSlider-'.$processedData['data']['uid'].' .MS-content .item {width: '.$flexconf['number'].'}';
if($cssFile)
GeneralUtility::makeInstance(AssetCollector::class)
->addStyleSheet('multislidercss', $cssFile,[],['priority' => true]);
if($block)
GeneralUtility::makeInstance(AssetCollector::class)
->addInlineStyleSheet('multisliderinlinecss-'.$processedData['data']['uid'], $block,[],['priority' => true]);

if($cssFile) {
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addCssFile($cssFile);
}
if($block) {
$pageRenderer->addCssInlineBlock ('multislider-'.$processedData['data']['uid'], $block);
}

if($jsFooterFile)
GeneralUtility::makeInstance(AssetCollector::class)
->addJavaScript('multisliderjs', $jsFooterFile);
Expand Down
Loading

0 comments on commit 6c7c270

Please sign in to comment.