diff --git a/Classes/Controller/LatestController.php b/Classes/Controller/LatestController.php index 714e99b2394b55b59db50d5dd5f7f843087c45e7..c4208869567a417c4b0fcd0ea7a6724d686f6588 100644 --- a/Classes/Controller/LatestController.php +++ b/Classes/Controller/LatestController.php @@ -55,10 +55,12 @@ class LatestController extends AbstractController { /** * Renders the news overview * + * @param array $newsMetaData + * @param int $offset * @return void * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException */ - public function indexAction() { + public function indexAction(array $newsMetaData = [], $offset = 0) { $limit = ((int) $this->settings['limit']); $limit = ($limit < 1 ? 1 : $limit); @@ -69,10 +71,9 @@ class LatestController extends AbstractController { } $latestNewsEntries = $this->newsRepository->findLastUpdatedOrHighlightedNewsByCategories( - $limit, FALSE, $categoryUids, 0, TRUE, $this->settings['sortBy'], $tagUids + $limit, FALSE, $categoryUids, $offset, TRUE, $this->settings['sortBy'], $tagUids ); - $newsMetaData = []; $categories = []; foreach ($latestNewsEntries as $latestNewsEntry) { /** @var News $latestNewsEntry */ @@ -88,8 +89,25 @@ class LatestController extends AbstractController { } $newsMetaData[] = $this->getMetaDataForNews($latestNewsEntry, $category); + // Make sure, that the amount is the same as the configured limit. + if (count($newsMetaData) >= $limit) { + break; + } } + // Redo this function, until $newsMetaData gets the $limit. Needed because of languagevisibility. + if (count($newsMetaData) < $limit) { + $offset += $limit; + $maxCount = $this->newsRepository->getCountOfLastUpdatedOrHighlightedNewsByCategories( + FALSE, $categoryUids, TRUE, $this->settings['sortBy'], $tagUids + ); + if ($offset < $maxCount) { + $this->indexAction($newsMetaData, $offset); + return; + } + } + + $this->view->assign('newsMetaData', $newsMetaData); } } diff --git a/Classes/Controller/ListByCategoryController.php b/Classes/Controller/ListByCategoryController.php index dd3296f039c8b985154b5f5fad2721ffe6bea31e..5ed37dc561b321aa0470f4542263204c22cf2036 100644 --- a/Classes/Controller/ListByCategoryController.php +++ b/Classes/Controller/ListByCategoryController.php @@ -55,10 +55,11 @@ class ListByCategoryController extends AbstractController { /** * Renders the news list of a category * + * @param array $newsMetaData * @return void * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException */ - public function indexAction() { + public function indexAction(array $newsMetaData = []) { $filterByCategories = FALSE; $categoryUids = GeneralUtility::intExplode(',', $this->settings['categories']); $tagUids = GeneralUtility::intExplode(',', $this->settings['tags'], TRUE); @@ -87,7 +88,6 @@ class ListByCategoryController extends AbstractController { $newsCount = $this->newsRepository->newsCountByCategories($categoryUids, $tagUids); $numberOfPages = ($newsPerPage <= 0 ? 0 : ceil($newsCount / $newsPerPage)); - $newsMetaData = []; $headerSet = FALSE; $news = $this->newsRepository->findAllSortedNewsByCategories( $categoryUids, $newsPerPage, $offset, $this->settings['sortBy'], $tagUids @@ -108,6 +108,16 @@ class ListByCategoryController extends AbstractController { } } + // Redo this function, until one variable get the amount of $newsPerPage. Reduces the amount of ajax calls. Needed because of languagevisibility. + if (count($newsMetaData) < $newsPerPage) { + $nextPage = $currentPageBrowserPage + 1; + if ($nextPage <= $numberOfPages) { + GeneralUtility::_GETset(['tx_sgnews_pagebrowser' => ['currentPage' => $nextPage]]); + $this->indexAction($newsMetaData); + return; + } + } + $this->view->assign('numberOfPages', $numberOfPages); $this->view->assign('newsMetaData', $newsMetaData); $this->view->assign('categories', $categories); diff --git a/Classes/Controller/OverviewController.php b/Classes/Controller/OverviewController.php index ab00cb2953d449804fbd92bfd67407761eeb7b78..5271e654697bc9dd08cc7fbdfe9a4c5b82042f54 100644 --- a/Classes/Controller/OverviewController.php +++ b/Classes/Controller/OverviewController.php @@ -111,10 +111,12 @@ class OverviewController extends AbstractController { /** * Renders the news overview grouped by categories * + * @param array $newsByCategory + * @param array $allNews * @return void * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException */ - protected function overviewWithCategories() { + protected function overviewWithCategories(array $newsByCategory = [], array $allNews = []) { $newsLimitPerCategory = (int) $this->settings['newsLimit']; $this->categoryRepository->setDefaultOrderings(['sorting' => Query::ORDER_ASCENDING]); @@ -147,24 +149,35 @@ class OverviewController extends AbstractController { /** @var News $newsEntry */ $categoryId = $newsEntry->getPid(); $category = $categoriesById[$categoryId]; + if (!$category) { + // Category isn't visible. + continue; + } $data = $this->getMetaDataForNews($newsEntry, $category); $newsMetaData[$categoryId][] = $data; } } - $newsByCategory = []; + $maxNewsPerCategory = 0; foreach ($categoriesById as $categoryId => $category) { /** @var $category Category */ - $newsByCategory[$categoryId] = [ - 'record' => $category, - 'recordId' => $categoryId, - 'recordType' => 'category', - 'newsMetaData' => $newsMetaData[$categoryId] - ]; + if (isset($newsByTag[$categoryId])) { + /** @var $category Category */ + $newsByCategory[$categoryId]['newsMetaData'] = + array_merge($newsByCategory[$categoryId]['newsMetaData'], $newsMetaData[$categoryId]); + } else { + $newsByCategory[$categoryId] = [ + 'record' => $category, + 'recordId' => $categoryId, + 'recordType' => 'category', + 'newsMetaData' => $newsMetaData[$categoryId] + ]; + } + + $maxNewsPerCategory = max($newsByCategory, count($newsByTag[$categoryId]['newsMetaData'])); } - $allNews = []; $news = $this->newsRepository->findAllSortedNewsByCategories( $categoryIds, $newsLimitPerCategory, $offset, $this->settings['sortBy'] ); @@ -172,6 +185,10 @@ class OverviewController extends AbstractController { /** @var News $newsEntry */ $categoryId = $newsEntry->getPid(); $category = $categoriesById[$categoryId]; + if (!$category) { + // Category isn't visible. + continue; + } $data = $this->getMetaDataForNews($newsEntry, $category); $allNews[] = $data; @@ -181,6 +198,16 @@ class OverviewController extends AbstractController { $newsCount = $this->newsRepository->newsCountByCategories($categoryIds); $numberOfPages = ($newsLimitPerCategory <= 0 ? 0 : ceil($newsCount / $newsLimitPerCategory)); + // Redo this function, until one variable get the amount of newsLimitPerTag. Reduces the amount of ajax calls. Needed because of languagevisibility. + if ($maxNewsPerCategory < $newsLimitPerCategory && count($allNews) < $newsLimitPerCategory) { + $nextPage = $currentPageBrowserPage + 1; + if ($nextPage <= $numberOfPages) { + GeneralUtility::_GETset(['tx_sgnews_pagebrowser' => ['currentPage' => $nextPage]]); + $this->overviewWithCategories($newsByCategory, $allNews); + return; + } + } + $this->view->assign('numberOfPages', $numberOfPages); $this->view->assign('newsItems', $newsByCategory); $this->view->assign('groupBy', 'category'); @@ -190,10 +217,12 @@ class OverviewController extends AbstractController { /** * Renders the news overview grouped by tags * + * @param array $newsByTag + * @param array $allNews * @return void * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException */ - protected function overviewWithTags() { + protected function overviewWithTags(array $newsByTag = [], array $allNews = []) { $newsLimitPerTag = (int) $this->settings['newsLimit']; $this->tagRepository->setDefaultOrderings(['sorting' => Query::ORDER_ASCENDING]); @@ -234,24 +263,40 @@ class OverviewController extends AbstractController { $categoriesById[$categoryId] = $this->categoryRepository->findByUid($categoryId); } $category = $categoriesById[$categoryId]; + if (!$category) { + // Category isn't visible. + continue; + } $data = $this->getMetaDataForNews($newsEntry, $category); $newsMetaData[$tagId][] = $data; } } - $newsByTag = []; + $maxNewsPerTag = 0; foreach ($tagsById as $tagId => $tag) { - /** @var $category Category */ - $newsByTag[$tagId] = [ - 'record' => $tag, - 'recordId' => $tagId, - 'recordType' => 'tag', - 'newsMetaData' => $newsMetaData[$tagId] - ]; + if (count($newsMetaData[$tagId]) <= 0) { + // Hide empty tags. + continue; + } + + if (isset($newsByTag[$tagId])) { + /** @var $category Category */ + $newsByTag[$tagId]['newsMetaData'] = + array_merge($newsByTag[$tagId]['newsMetaData'], $newsMetaData[$tagId]); + } else { + /** @var $category Category */ + $newsByTag[$tagId] = [ + 'record' => $tag, + 'recordId' => $tagId, + 'recordType' => 'tag', + 'newsMetaData' => $newsMetaData[$tagId] + ]; + } + + $maxNewsPerTag = max($maxNewsPerTag, count($newsByTag[$tagId]['newsMetaData'])); } - $allNews = []; $news = $this->newsRepository->findAllSortedNewsByCategories( NULL, $newsLimitPerTag, $offset, $this->settings['sortBy'], $tagIds ); @@ -262,6 +307,10 @@ class OverviewController extends AbstractController { $categoriesById[$categoryId] = $this->categoryRepository->findByUid($categoryId); } $category = $categoriesById[$categoryId]; + if (!$category) { + // Category isn't visible. + continue; + } $data = $this->getMetaDataForNews($newsEntry, $category); $allNews[] = $data; @@ -271,6 +320,16 @@ class OverviewController extends AbstractController { $newsCount = $this->newsRepository->newsCountByCategories([], $tagIds); $numberOfPages = ($newsLimitPerTag <= 0 ? 0 : ceil($newsCount / $newsLimitPerTag)); + // Redo this function, until one variable get the amount of newsLimitPerTag. Reduces the amount of ajax calls. Needed because of languagevisibility. + if ($maxNewsPerTag < $newsLimitPerTag && count($allNews) < $newsLimitPerTag) { + $nextPage = $currentPageBrowserPage + 1; + if ($nextPage <= $numberOfPages) { + GeneralUtility::_GETset(['tx_sgnews_pagebrowser' => ['currentPage' => $nextPage]]); + $this->overviewWithTags($newsByTag, $allNews); + return; + } + } + $this->view->assign('numberOfPages', $numberOfPages); $this->view->assign('newsItems', $newsByTag); $this->view->assign('groupBy', 'tag'); @@ -280,10 +339,11 @@ class OverviewController extends AbstractController { /** * Renders the news in a paginated list * + * @param array $newsMetaData * @return void * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException */ - protected function overviewWithoutCategoriesAction() { + protected function overviewWithoutCategoriesAction(array $newsMetaData = []) { $offset = 0; $newsPerPage = (int) $this->settings['newsLimit']; $currentPageBrowserPage = (int) GeneralUtility::_GP('tx_sgnews_pagebrowser')['currentPage']; @@ -318,7 +378,6 @@ class OverviewController extends AbstractController { } } - $newsMetaData = []; $news = $this->newsRepository->findAllSortedNewsByCategories( $categoryIds, $newsPerPage, $offset, $this->settings['sortBy'] ); @@ -331,6 +390,16 @@ class OverviewController extends AbstractController { $this->highlightBestFitNews($categoryIds); $numberOfPages = ($newsPerPage <= 0 ? 0 : ceil($newsCount / $newsPerPage)); + // Redo this function, until one variable get the amount of newsLimitPerTag. Reduces the amount of ajax calls. Needed because of languagevisibility. + if (count($newsMetaData) < $newsPerPage) { + $nextPage = $currentPageBrowserPage + 1; + if ($nextPage <= $numberOfPages) { + GeneralUtility::_GETset(['tx_sgnews_pagebrowser' => ['currentPage' => $nextPage]]); + $this->overviewWithoutCategoriesAction($newsMetaData); + return; + } + } + $this->view->assign('numberOfPages', $numberOfPages); $this->view->assign('newsMetaData', $newsMetaData); } diff --git a/Classes/Domain/Model/News.php b/Classes/Domain/Model/News.php index 3f7d93fac1d67d9696eaa60d95c298f4ff0144b0..4983ad425105c18666f4704693b5b95e670e8f3f 100644 --- a/Classes/Domain/Model/News.php +++ b/Classes/Domain/Model/News.php @@ -34,11 +34,6 @@ use TYPO3\CMS\Extbase\Persistence\ObjectStorage; * News */ class News extends CategoryAndNews { - /** - * @var string - */ - protected $navTitle = ''; - /** * @var string */ @@ -260,7 +255,7 @@ class News extends CategoryAndNews { * @return void */ public function setNeverHighlighted($neverHighlighted) { - $this->neverHighlighted = ($neverHighlighted === TRUE); + $this->neverHighlighted = ($neverHighlighted == TRUE); } /** @@ -295,6 +290,4 @@ class News extends CategoryAndNews { public function setLikes($likes) { $this->likes = $likes; } - - } diff --git a/Classes/Domain/Repository/NewsRepository.php b/Classes/Domain/Repository/NewsRepository.php index 68c4aacf01985883ab1c79aff6c641aa481a0d52..393250b13f3a9e5120adb29d62143bdfe3f9a2a3 100644 --- a/Classes/Domain/Repository/NewsRepository.php +++ b/Classes/Domain/Repository/NewsRepository.php @@ -155,6 +155,49 @@ class NewsRepository extends AbstractRepository { public function findLastUpdatedOrHighlightedNewsByCategories( $limit = 1, $onlyHighlighted = FALSE, array $categoryIds = NULL, $offset = 0, $hideNeverHighlightedNews = FALSE, $sortBy = 'date', array $tagIds = NULL + ) { + return $this->getQueryForLastUpdatedOrHighlightedNewsByCategories( + $limit, $onlyHighlighted, $categoryIds, $offset, $hideNeverHighlightedNews, $sortBy, $tagIds + )->execute(); + } + + /** + * Returns the count of all possible last news. + * + * @param bool $onlyHighlighted + * @param array $categoryIds NULL, if the category filter isn't applied, otherwise an array with the categories uid. + * @param int $offset + * @param bool $hideNeverHighlightedNews + * @param string $sortBy date or positionInTree + * @param array $tagIds NULL, if the tag filter isn't applied, otherwise an array with the tag uids. + * @return int + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException + */ + public function getCountOfLastUpdatedOrHighlightedNewsByCategories( + $onlyHighlighted = FALSE, array $categoryIds = NULL, $hideNeverHighlightedNews = FALSE, $sortBy = 'date', + array $tagIds = NULL + ) { + return $this->getQueryForLastUpdatedOrHighlightedNewsByCategories( + 0, $onlyHighlighted, $categoryIds, 0, $hideNeverHighlightedNews, $sortBy, $tagIds + )->count(); + } + + /** + * Returns the query object of the LastUpdatedOrHighlightedNewsByCategories. + * + * @param int $limit + * @param bool $onlyHighlighted + * @param array $categoryIds NULL, if the category filter isn't applied, otherwise an array with the categories uid. + * @param int $offset + * @param bool $hideNeverHighlightedNews + * @param string $sortBy date or positionInTree + * @param array $tagIds NULL, if the tag filter isn't applied, otherwise an array with the tag uids. + * @return QueryInterface + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException + */ + protected function getQueryForLastUpdatedOrHighlightedNewsByCategories( + $limit = 1, $onlyHighlighted = FALSE, array $categoryIds = NULL, + $offset = 0, $hideNeverHighlightedNews = FALSE, $sortBy = 'date', array $tagIds = NULL ) { $query = $this->createQuery(); $constraints = NULL; @@ -215,7 +258,7 @@ class NewsRepository extends AbstractRepository { $query->setOffset($offset); } - return $query->matching($constraints)->execute(); + return $query->matching($constraints); } // /** diff --git a/Classes/Xclass/Typo3DbBackend.php b/Classes/Xclass/Typo3DbBackend.php index 8bd2e6d9d05157ee515631181b8aa432049af532..ece9d35c7e2ddcc038ff1dcb23a1273a579a2b7f 100755 --- a/Classes/Xclass/Typo3DbBackend.php +++ b/Classes/Xclass/Typo3DbBackend.php @@ -26,7 +26,10 @@ namespace SGalinski\SgNews\Xclass; ***************************************************************/ use TYPO3\CMS\Backend\Utility\BackendUtility; +use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Persistence\Generic\Qom; +use TYPO3\Languagevisibility\Service\FrontendServices; /** * Xclass for the TYPO3 db backend, which handles, that the l18n_cfg parameters are used for pages in Extbase. @@ -85,6 +88,7 @@ class Typo3DbBackend extends \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo } } + $isLanguagevisibilityLoaded = ExtensionManagementUtility::isLoaded('languagevisibility'); $overlaidRows = array(); foreach ($rows as $row) { // If current row is a translation select its parent @@ -106,12 +110,23 @@ class Typo3DbBackend extends \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo } $pageRepository->versionOL($tableName, $row, true); if ($tableName == 'pages') { + // Start of the patch + // Applies the language visibility logic. + if ($isLanguagevisibilityLoaded && is_object($GLOBALS['TSFE'])) { + $sysLanguageUid = $GLOBALS['TSFE']->sys_language_uid; + if (!FrontendServices::checkVisiblityForElement((int) $row['uid'], $tableName, $sysLanguageUid)) { + // Page not visible + continue; + } + } + + // End of the patch + $row = $pageRepository->getPageOverlay($row, $querySettings->getLanguageUid()); if ($row === null || !is_array($row)) { continue; } - // Start of the patch $l18nConfiguration = $row['l18n_cfg']; if ($l18nConfiguration > 0) { diff --git a/README.md b/README.md index 1de09acc8eda4f9f194835c482ca64b1cca7a96c..cca83e8ef4fda816c74148c26c88ae4813b16892 100644 --- a/README.md +++ b/README.md @@ -214,4 +214,7 @@ You find the settings in the **Fontend/constants.txt** configuration file: } --- ###### addLike + Automatically adds an AJAX like button to each single news entry. +Make sure, that the extension sg_ajax is installed, otherwise this feature will be disabled. +If it should be like this, then make sure to remove this button from the sg_news default templates. diff --git a/Resources/Private/Templates/Overview/Overview.html b/Resources/Private/Templates/Overview/Overview.html index a560c39910b35a3462c22d1da74b839a2f1c0307..c69e01c66d156c11266f0ee738f167fbb4a88fb5 100644 --- a/Resources/Private/Templates/Overview/Overview.html +++ b/Resources/Private/Templates/Overview/Overview.html @@ -3,35 +3,50 @@ {namespace sg=SGalinski\SgNews\ViewHelpers} <f:section name="main"> - <f:if condition="{newsItems}"> - <div class="tx-sgnews-categories"> - <ul class="nav nav-tabs"> - <li class="tx-sgnews-category active"> - <a data-toggle="tab" href="#sgnewsTab0"> - <f:translate key="frontend.overview.allTabLabel" /> + <div class="tx-sgnews-categories"> + <ul class="nav nav-tabs"> + <li class="tx-sgnews-category active"> + <a data-toggle="tab" href="#sgnewsTab0"> + <f:translate key="frontend.overview.allTabLabel" /> + </a> + </li> + <f:for each="{newsItems}" as="dataItems"> + <li class="tx-sgnews-category"> + <a data-toggle="tab" href="#sgnewsTab{dataItems.record.uid}"> + <f:if condition="{dataItems.recordType} == 'category'"> + <f:then> + {dataItems.record.subtitleWithFallbackToTitle} + </f:then> + <f:else> + {dataItems.record.title} + </f:else> + </f:if> </a> </li> - <f:for each="{newsItems}" as="dataItems"> - <li class="tx-sgnews-category"> - <a data-toggle="tab" href="#sgnewsTab{dataItems.record.uid}"> - <f:if condition="{dataItems.recordType} == 'category'"> - <f:then> - {dataItems.record.subtitleWithFallbackToTitle} - </f:then> - <f:else> - {dataItems.record.title} - </f:else> - </f:if> - </a> - </li> - </f:for> - </ul> + </f:for> + </ul> - <div class="tab-content"> - <div class="tab-pane active" id="sgnewsTab0"> - <h4 class="tx-sgnews-tab-title"><f:translate key="frontend.overview.allTabLabel" /></h4> - <ul class="tx-sgnews-list tx-sgnews-list-0 row" data-record="0"> - <f:for each="{allNews}" as="newsMetaDataEntry"> + <div class="tab-content"> + <div class="tab-pane active" id="sgnewsTab0"> + <h4 class="tx-sgnews-tab-title"><f:translate key="frontend.overview.allTabLabel" /></h4> + <ul class="tx-sgnews-list tx-sgnews-list-0 row" data-record="0"> + <f:for each="{allNews}" as="newsMetaDataEntry"> + <li class="col-md-4 col-sm-6 col-xs-12"> + <f:render partial="Teaser" arguments="{ + newsMetaData: newsMetaDataEntry, + headerTag: '<h2>', + closingHeaderTag: '</h2>', + showCategory: '{f:if(condition: \'{groupBy} == \"category\"\', then: 0, else: 1)}' + }" /> + </li> + </f:for> + </ul> + </div> + <f:for each="{newsItems}" as="dataItems"> + <div class="tab-pane" id="sgnewsTab{dataItems.record.uid}"> + <h4 class="tx-sgnews-tab-title">{dataItems.record.title}</h4> + <ul class="tx-sgnews-list tx-sgnews-list-{dataItems.record.uid} row" data-record="{dataItems.record.uid}"> + <f:for each="{dataItems.newsMetaData}" as="newsMetaDataEntry"> <li class="col-md-4 col-sm-6 col-xs-12"> <f:render partial="Teaser" arguments="{ newsMetaData: newsMetaDataEntry, @@ -42,35 +57,18 @@ </li> </f:for> </ul> - </div> - <f:for each="{newsItems}" as="dataItems"> - <div class="tab-pane" id="sgnewsTab{dataItems.record.uid}"> - <h4 class="tx-sgnews-tab-title">{dataItems.record.title}</h4> - <ul class="tx-sgnews-list tx-sgnews-list-{dataItems.record.uid} row" data-record="{dataItems.record.uid}"> - <f:for each="{dataItems.newsMetaData}" as="newsMetaDataEntry"> - <li class="col-md-4 col-sm-6 col-xs-12"> - <f:render partial="Teaser" arguments="{ - newsMetaData: newsMetaDataEntry, - headerTag: '<h2>', - closingHeaderTag: '</h2>', - showCategory: '{f:if(condition: \'{groupBy} == \"category\"\', then: 0, else: 1)}' - }" /> - </li> - </f:for> - </ul> - <f:if condition="{dataItems.recordType} == 'category'"> - <div class="text-center"> - <a class="btn btn-md btn-success category-{dataByCategory.category.uid}" href="{f:uri.page(pageUid: '{dataByCategory.category.uid}')}"> - <f:translate key="frontend.overview.showAllEntries" /> - </a> - </div> - </f:if> - </div> - </f:for> - </div> + <f:if condition="{dataItems.recordType} == 'category'"> + <div class="text-center"> + <a class="btn btn-md btn-success category-{dataByCategory.category.uid}" href="{f:uri.page(pageUid: '{dataByCategory.category.uid}')}"> + <f:translate key="frontend.overview.showAllEntries" /> + </a> + </div> + </f:if> + </div> + </f:for> </div> + </div> - <sg:pageBrowser numberOfPages="{numberOfPages}" /> - </f:if> + <sg:pageBrowser numberOfPages="{numberOfPages}" /> </f:section> diff --git a/composer.json b/composer.json index 40ac866b6ae9f9ca7660f745e89f25b896460811..32baf44ca34cd6c617a3bff17f6d5b8c4bc2e597 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": [ "GPL-2.0+" ], - "version": "3.7.1", + "version": "3.8.0", "support": { }, "repositories": [ @@ -19,6 +19,7 @@ "typo3/cms-core": "^7.6" }, "suggest": { + "sgalinski/sg-ajax": "Needed for the like feature", "sgalinski/sg-comments": "Flexible comments system", "typo3-ter/rx-shariff": "Social Share possibilities" }, diff --git a/ext_emconf.php b/ext_emconf.php index fface535e76267f61ba9c14ea9d5654f394be421..c26edeea0e54dbbe07269870ea2958c5600e275f 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -19,7 +19,7 @@ $EM_CONF[$_EXTKEY] = [ 'modify_tables' => '', 'clearCacheOnLoad' => 0, 'lockType' => '', - 'version' => '3.7.1', + 'version' => '3.8.0', 'constraints' => [ 'depends' => [ 'typo3' => '7.6.0-7.6.99', @@ -29,6 +29,7 @@ $EM_CONF[$_EXTKEY] = [ 'suggests' => [ 'sg_comments' => '2.1.0-', 'rx_shariff' => '5.0.1-', + 'sg_ajax' => '1.0.6-', ], ], 'suggests' => [], diff --git a/ext_localconf.php b/ext_localconf.php index 5206b7098beeb699754919dc99ea807df296ad4e..0ed3fdf6bb7dd568a9d2c74200079b2a557f1856 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -63,10 +63,12 @@ $tsPath = $extPath . 'Configuration/TypoScript/Common/'; ['PageBrowser' => '',] ); -\SGalinski\SgAjax\Service\AjaxRegistration::configureAjaxFrontendPlugin('sg_news', [ - 'Ajax\Like' => 'addLike', - ] -); +if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sg_ajax')) { + \SGalinski\SgAjax\Service\AjaxRegistration::configureAjaxFrontendPlugin('sg_news', [ + 'Ajax\Like' => 'addLike', + ] + ); +} // hook registration $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = diff --git a/ext_tables.php b/ext_tables.php index 8fe702bb7ca61d19eedab73e2249aca3eaec56cf..eaa1b09b6fcb0ca973c00307f170a077c1bf5774 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -138,4 +138,6 @@ $GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][$customPageDoktype] = 'tcar 'options.pageTree.doktypesToShowInNewPageDragArea := addToList(' . $customPageDoktype . ')' ); -\SGalinski\SgAjax\Service\AjaxRegistration::registerAjaxFrontendPlugin('sg_news'); +if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sg_ajax')) { + \SGalinski\SgAjax\Service\AjaxRegistration::registerAjaxFrontendPlugin('sg_news'); +}