Skip to content

Commit 6fbe73f

Browse files
authored
Unlock contao 5.3 (see #2)
1 parent d84a040 commit 6fbe73f

File tree

11 files changed

+301
-236
lines changed

11 files changed

+301
-236
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.idea
22
/node_modules/
33
/package-lock.json
4+
/vendor
5+
/composer.lock

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Oveleon
3+
Copyright (c) 2024 Oveleon
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
}
1919
],
2020
"require":{
21-
"php":">=7.4",
22-
"contao/core-bundle":"^4.9",
23-
"contao/news-bundle":"^4.9"
21+
"php":"^8.1",
22+
"contao/core-bundle":"^4.13 || ^5.3",
23+
"contao/news-bundle":"^4.13 || ^5.3",
24+
"symfony/http-kernel": "^5.4 || ^6.4 || ^7.0"
2425
},
2526
"require-dev": {
26-
"contao/manager-plugin": "^2.0"
27+
"contao/manager-plugin": "^2.3.1"
2728
},
2829
"conflict": {
2930
"contao/core": "*",

src/ContaoManager/Plugin.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@
22

33
declare(strict_types=1);
44

5+
/*
6+
* This file is part of Contao News Popup.
7+
*
8+
* @package contao-news-popup
9+
* @license MIT
10+
* @author Daniele Sciannimanica <https://github.com/doishub>
11+
* @copyright Oveleon <https://www.oveleon.de/>
12+
*/
13+
514
namespace Oveleon\ContaoNewsPopup\ContaoManager;
615

716
use Contao\CoreBundle\ContaoCoreBundle;
817
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
918
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
1019
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
11-
use Oveleon\ContaoNewsPopup\ContaoNewsPopup;
1220
use Contao\NewsBundle\ContaoNewsBundle;
21+
use Oveleon\ContaoNewsPopup\ContaoNewsPopup;
1322

1423
class Plugin implements BundlePluginInterface
1524
{
16-
/**
17-
* {@inheritdoc}
18-
*/
1925
public function getBundles(ParserInterface $parser): array
2026
{
2127
return [

src/ContaoNewsPopup.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
declare(strict_types=1);
44

5+
/*
6+
* This file is part of Contao News Popup.
7+
*
8+
* @package contao-news-popup
9+
* @license MIT
10+
* @author Daniele Sciannimanica <https://github.com/doishub>
11+
* @copyright Oveleon <https://www.oveleon.de/>
12+
*/
13+
514
namespace Oveleon\ContaoNewsPopup;
615

716
use Symfony\Component\HttpKernel\Bundle\Bundle;
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
<?php
22

3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of Contao News Popup.
7+
*
8+
* @package contao-news-popup
9+
* @license MIT
10+
* @author Daniele Sciannimanica <https://github.com/doishub>
11+
* @copyright Oveleon <https://www.oveleon.de/>
12+
*/
13+
314
namespace Oveleon\ContaoNewsPopup;
415

5-
use Contao\DataContainer;
616
use Contao\Controller;
17+
use Contao\DataContainer;
718

819
class Popup extends Controller
920
{
1021
public function onLoadModuleTemplate(string $strValue, DataContainer $dc): string
1122
{
12-
if($dc->activeRecord->type !== 'newspopup')
23+
if ('newspopup' !== $dc->activeRecord->type)
1324
{
1425
return $strValue;
1526
}
1627

1728
$GLOBALS['TL_DCA']['tl_module']['fields']['news_template']['eval']['includeBlankOption'] = false;
18-
$GLOBALS['TL_DCA']['tl_module']['fields']['news_template']['options_callback'] = static function ()
19-
{
20-
return Controller::getTemplateGroup('news_popup_');
21-
};
29+
$GLOBALS['TL_DCA']['tl_module']['fields']['news_template']['options_callback'] = static fn () => Controller::getTemplateGroup('news_popup_');
2230

2331
return $strValue;
2432
}
25-
}
33+
}
Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of Contao News Popup.
7+
*
8+
* @package contao-news-popup
9+
* @license MIT
10+
* @author Daniele Sciannimanica <https://github.com/doishub>
11+
* @copyright Oveleon <https://www.oveleon.de/>
12+
*/
13+
14+
use Oveleon\ContaoNewsPopup\ModuleNewsPopup;
15+
216
// Front end modules
3-
$GLOBALS['FE_MOD']['news']['newspopup'] = 'Oveleon\ContaoNewsPopup\ModuleNewsPopup';
17+
$GLOBALS['FE_MOD']['news']['newspopup'] = ModuleNewsPopup::class;
418

519
// Models
6-
$GLOBALS['TL_MODELS']['tl_popup_news'] = Oveleon\ContaoNewsPopup\ModuleNewsPopup::class;
20+
$GLOBALS['TL_MODELS']['tl_popup_news'] = ModuleNewsPopup::class;
Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of Contao News Popup.
7+
*
8+
* @package contao-news-popup
9+
* @license MIT
10+
* @author Daniele Sciannimanica <https://github.com/doishub>
11+
* @copyright Oveleon <https://www.oveleon.de/>
12+
*/
13+
14+
use Oveleon\ContaoNewsPopup\Popup;
15+
216
// Palette
317
$GLOBALS['TL_DCA']['tl_module']['palettes']['newspopup'] = '{title_legend},name,headline,type;{config_legend},news_archives,news_readerModule,news_featured,news_order;{template_legend:hide},news_metaFields,news_template,customTpl,news_popup_placement;{image_legend:hide},imgSize;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
418

519
// Fields
6-
$GLOBALS['TL_DCA']['tl_module']['fields']['news_popup_placement'] = array
7-
(
8-
'exclude' => true,
9-
'inputType' => 'select',
10-
'options' => ['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'],
11-
'reference' => &$GLOBALS['TL_LANG']['tl_module'],
12-
'eval' => array('tl_class'=>'w50 clr'),
13-
'sql' => "varchar(16) NOT NULL default 'bottom-right'"
14-
);
15-
20+
$GLOBALS['TL_DCA']['tl_module']['fields']['news_popup_placement'] = [
21+
'exclude' => true,
22+
'inputType' => 'select',
23+
'options' => ['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'],
24+
'reference' => &$GLOBALS['TL_LANG']['tl_module'], 'eval' => ['tl_class' => 'w50 clr'],
25+
'sql' => "varchar(16) NOT NULL default 'bottom-right'"
26+
];
1627

1728
// Field callback
18-
$GLOBALS['TL_DCA']['tl_module']['fields']['news_template']['load_callback'][] = [Oveleon\ContaoNewsPopup\Popup::class, 'onLoadModuleTemplate'];
29+
$GLOBALS['TL_DCA']['tl_module']['fields']['news_template']['load_callback'][] = [Popup::class, 'onLoadModuleTemplate'];
Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of Contao News Popup.
7+
*
8+
* @package contao-news-popup
9+
* @license MIT
10+
* @author Daniele Sciannimanica <https://github.com/doishub>
11+
* @copyright Oveleon <https://www.oveleon.de/>
12+
*/
13+
14+
use Contao\CoreBundle\DataContainer\PaletteManipulator;
15+
216
// Extend the default palette
3-
Contao\CoreBundle\DataContainer\PaletteManipulator::create()
4-
->addField('popup', 'featured', Contao\CoreBundle\DataContainer\PaletteManipulator::POSITION_AFTER)
17+
PaletteManipulator::create()
18+
->addField('popup', 'featured')
519
->applyToPalette('default', 'tl_news')
620
->applyToPalette('internal', 'tl_news')
721
->applyToPalette('article', 'tl_news')
@@ -10,9 +24,9 @@
1024

1125
// Fields
1226
$GLOBALS['TL_DCA']['tl_news']['fields']['popup'] = [
13-
'exclude' => true,
14-
'filter' => true,
15-
'inputType' => 'checkbox',
16-
'eval' => ['tl_class'=>'w50 cbx m12'],
17-
'sql' => "char(1) NOT NULL default ''"
27+
'exclude' => true,
28+
'filter' => true,
29+
'inputType' => 'checkbox',
30+
'eval' => ['tl_class' => 'w50 cbx m12'],
31+
'sql' => "char(1) NOT NULL default ''",
1832
];

0 commit comments

Comments
 (0)