Skip to content

Commit

Permalink
Fix compatibility with Codefog News Categories bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
seibtph committed Jul 18, 2023
1 parent 8476213 commit 84d5479
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Types of changes
Security in case of vulnerabilities.
)

## [2.12.4](https://github.com/pdir/contao-webtools/tree/2.12.4) - 2023-07-18

- [Fixed] Fix compatibility with Codefog News Categories bundle

## [2.12.3](https://github.com/pdir/contao-webtools/tree/2.12.3) - 2023-06-27

- [Fixed] Fix dca to make compatible with ContaoNewsBundle ^4.4 ([#94](https://github.com/pdir/social-feed-bundle/issues/94))
Expand Down
3 changes: 2 additions & 1 deletion src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

namespace Pdir\SocialFeedBundle\ContaoManager;

use Codefog\NewsCategoriesBundle\CodefogNewsCategoriesBundle;
use Contao\CoreBundle\ContaoCoreBundle;
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
Expand All @@ -38,7 +39,7 @@ public function getBundles(ParserInterface $parser)
{
return [
BundleConfig::create(PdirSocialFeedBundle::class)
->setLoadAfter([ContaoCoreBundle::class])
->setLoadAfter([ContaoCoreBundle::class, CodefogNewsCategoriesBundle::class])

Check failure on line 42 in src/ContaoManager/Plugin.php

View workflow job for this annotation

GitHub Actions / PHPStan

Class Codefog\NewsCategoriesBundle\CodefogNewsCategoriesBundle not found.

Check failure on line 42 in src/ContaoManager/Plugin.php

View workflow job for this annotation

GitHub Actions / PHPStan

Class Codefog\NewsCategoriesBundle\CodefogNewsCategoriesBundle not found.
->setReplace(['socialfeedbundle']),
];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Dca/tl_social_feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class tl_social_feed
/**
* social-feed-bundle version.
*/
public const VERSION = '2.12.3';
public const VERSION = '2.12.4';

/**
* Template.
Expand Down
51 changes: 51 additions & 0 deletions src/Module/NewsCategoriesModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

Check failure on line 1 in src/Module/NewsCategoriesModule.php

View workflow job for this annotation

GitHub Actions / PHPStan

Class Codefog\NewsCategoriesBundle\FrontendModule\NewsListModule not found.

Check failure on line 1 in src/Module/NewsCategoriesModule.php

View workflow job for this annotation

GitHub Actions / PHPStan

Class Codefog\NewsCategoriesBundle\FrontendModule\NewsListModule not found.

declare(strict_types=1);

/*
* social feed bundle for Contao Open Source CMS
*
* Copyright (c) 2023 pdir / digital agentur // pdir GmbH
*
* @package social-feed-bundle
* @link https://github.com/pdir/social-feed-bundle
* @license http://www.gnu.org/licences/lgpl-3.0.html LGPL
* @author Mathias Arzberger <[email protected]>
* @author Philipp Seibt <[email protected]>
* @author pdir GmbH <https://pdir.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Pdir\SocialFeedBundle\Module;

use Contao\LayoutModel;
use Codefog\NewsCategoriesBundle\FrontendModule\NewsListModule;
use Pdir\SocialFeedBundle\Module\ModuleCustomNewslist;

class NewsCategoriesModule extends NewsListModule
{
/**
* Template.
*
* @var string
*/
protected $strTemplate = 'mod_newslist';

protected function compile(): void
{
parent::compile();

$this->Template->sfMasonry = $this->pdir_sf_enableMasonry;
$this->Template->sfColumns = ' '.$this->pdir_sf_columns;

$layout = LayoutModel::findByPk($GLOBALS['objPage']->layout);

if (null !== $layout->scripts && strpos($layout->scripts, 'lazyload')) {
$this->Template->lazyload = true;
} else {
$this->Template->lazyload = false;
}
}
}
11 changes: 10 additions & 1 deletion src/Resources/contao/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

use Pdir\SocialFeedBundle\Module\ModuleCustomNewslist;
use Pdir\SocialFeedBundle\Module\NewsCategoriesModule;

Check failure on line 22 in src/Resources/contao/config/config.php

View workflow job for this annotation

GitHub Actions / PHPStan

Class Codefog\NewsCategoriesBundle\FrontendModule\NewsListModule not found.

Check failure on line 22 in src/Resources/contao/config/config.php

View workflow job for this annotation

GitHub Actions / PHPStan

Class Codefog\NewsCategoriesBundle\FrontendModule\NewsListModule not found.

/*
* Backend modules
Expand Down Expand Up @@ -46,7 +47,15 @@
/*
* Frontend modules
*/
$GLOBALS['FE_MOD']['news']['newslist'] = ModuleCustomNewslist::class;
if(false === strpos($GLOBALS['FE_MOD']['news']['newslist'], 'Codefog\NewsCategoriesBundle'))
{
$GLOBALS['FE_MOD']['news']['newslist'] = ModuleCustomNewslist::class;
}

if(false !== strpos($GLOBALS['FE_MOD']['news']['newslist'], 'Codefog\NewsCategoriesBundle'))
{
$GLOBALS['FE_MOD']['news']['newslist'] = NewsCategoriesModule::class;

Check failure on line 57 in src/Resources/contao/config/config.php

View workflow job for this annotation

GitHub Actions / PHPStan

Class Codefog\NewsCategoriesBundle\FrontendModule\NewsListModule not found.

Check failure on line 57 in src/Resources/contao/config/config.php

View workflow job for this annotation

GitHub Actions / PHPStan

Class Codefog\NewsCategoriesBundle\FrontendModule\NewsListModule not found.
}

/*
* Crons
Expand Down

0 comments on commit 84d5479

Please sign in to comment.