Skip to content

Commit

Permalink
Update Contao to version 4.13 and 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Aug 7, 2022
1 parent adfe599 commit 8ca672a
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 26 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"source":"https://github.com/madeyourday/contao-rocksolid-columns"
},
"require":{
"php":">=5.5",
"contao/core-bundle":"^4.3"
"php":">=7.4",
"contao/core-bundle":"^4.13 || ^5.0"
},
"require-dev": {
"contao/manager-plugin": "^2.0"
Expand Down
8 changes: 5 additions & 3 deletions src/Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

namespace MadeYourDay\RockSolidColumns;

use Contao\Database;
use Contao\DataContainer;
use Contao\Encryption;
use Contao\LayoutModel;
use Contao\PageModel;
use Contao\PageRegular;
Expand Down Expand Up @@ -97,7 +99,7 @@ public function onsubmitCallback($dc)
if ($activeRecord->type === 'rs_columns_start' || $activeRecord->type === 'rs_column_start') {

// Find the next columns or column element
$nextElement = \Database::getInstance()
$nextElement = Database::getInstance()
->prepare('
SELECT type
FROM tl_content
Expand Down Expand Up @@ -130,7 +132,7 @@ public function onsubmitCallback($dc)
if (array_key_exists('default', $config)) {
$set[$field] = \is_array($config['default']) ? serialize($config['default']) : $config['default'];
if ($GLOBALS['TL_DCA']['tl_content']['fields'][$field]['eval']['encrypt']) {
$set[$field] = \Encryption::encrypt($set[$field]);
$set[$field] = Encryption::encrypt($set[$field]);
}
}
}
Expand All @@ -144,7 +146,7 @@ public function onsubmitCallback($dc)
$set['stop'] = $activeRecord->stop;
$set['tstamp'] = time();

\Database::getInstance()
Database::getInstance()
->prepare('INSERT INTO tl_content %s')
->set($set)
->execute();
Expand Down
16 changes: 11 additions & 5 deletions src/Element/ColumnStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@

namespace MadeYourDay\RockSolidColumns\Element;

use Contao\BackendTemplate;
use Contao\ContentElement;
use Contao\FrontendTemplate;
use Contao\System;
use Symfony\Component\HttpFoundation\Request;

/**
* Column start content element
*
* @author Martin Auswöger <[email protected]>
*/
class ColumnStart extends \ContentElement
class ColumnStart extends ContentElement
{
/**
* @var string Template
Expand All @@ -27,7 +33,7 @@ class ColumnStart extends \ContentElement
*/
public function generate()
{
if (TL_MODE === 'BE') {
if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) {
return parent::generate();
}

Expand Down Expand Up @@ -71,13 +77,13 @@ public function generate()
*/
public function compile()
{
if (TL_MODE == 'BE') {
if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) {
$this->strTemplate = 'be_wildcard';
$this->Template = new \BackendTemplate($this->strTemplate);
$this->Template = new BackendTemplate($this->strTemplate);
$this->Template->title = $this->headline;
}
else {
$this->Template = new \FrontendTemplate($this->strTemplate);
$this->Template = new FrontendTemplate($this->strTemplate);
$this->Template->setData($this->arrData);
}
}
Expand Down
16 changes: 11 additions & 5 deletions src/Element/ColumnStop.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@

namespace MadeYourDay\RockSolidColumns\Element;

use Contao\BackendTemplate;
use Contao\ContentElement;
use Contao\FrontendTemplate;
use Contao\System;
use Symfony\Component\HttpFoundation\Request;

/**
* Column stop content element
*
* @author Martin Auswöger <[email protected]>
*/
class ColumnStop extends \ContentElement
class ColumnStop extends ContentElement
{
/**
* @var string Template
Expand All @@ -27,7 +33,7 @@ class ColumnStop extends \ContentElement
*/
public function generate()
{
if (TL_MODE === 'BE') {
if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) {
return parent::generate();
}

Expand All @@ -49,13 +55,13 @@ public function generate()
*/
public function compile()
{
if (TL_MODE == 'BE') {
if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) {
$this->strTemplate = 'be_wildcard';
$this->Template = new \BackendTemplate($this->strTemplate);
$this->Template = new BackendTemplate($this->strTemplate);
$this->Template->title = $this->headline;
}
else {
$this->Template = new \FrontendTemplate($this->strTemplate);
$this->Template = new FrontendTemplate($this->strTemplate);
$this->Template->setData($this->arrData);
}
}
Expand Down
16 changes: 11 additions & 5 deletions src/Element/ColumnsStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@

namespace MadeYourDay\RockSolidColumns\Element;

use Contao\BackendTemplate;
use Contao\ContentElement;
use Contao\FrontendTemplate;
use Contao\System;
use Symfony\Component\HttpFoundation\Request;

/**
* Columns start content element
*
* @author Martin Auswöger <[email protected]>
*/
class ColumnsStart extends \ContentElement
class ColumnsStart extends ContentElement
{
/**
* @var string Template
Expand All @@ -27,7 +33,7 @@ class ColumnsStart extends \ContentElement
*/
public function generate()
{
if (TL_MODE === 'BE') {
if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) {
return parent::generate();
}

Expand Down Expand Up @@ -122,13 +128,13 @@ public static function getColumnsConfiguration(array $data)
*/
public function compile()
{
if (TL_MODE == 'BE') {
if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) {
$this->strTemplate = 'be_wildcard';
$this->Template = new \BackendTemplate($this->strTemplate);
$this->Template = new BackendTemplate($this->strTemplate);
$this->Template->title = $this->headline;
}
else {
$this->Template = new \FrontendTemplate($this->strTemplate);
$this->Template = new FrontendTemplate($this->strTemplate);
$this->Template->setData($this->arrData);
}
}
Expand Down
16 changes: 11 additions & 5 deletions src/Element/ColumnsStop.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@

namespace MadeYourDay\RockSolidColumns\Element;

use Contao\BackendTemplate;
use Contao\ContentElement;
use Contao\FrontendTemplate;
use Contao\System;
use Symfony\Component\HttpFoundation\Request;

/**
* Columns stop content element
*
* @author Martin Auswöger <[email protected]>
*/
class ColumnsStop extends \ContentElement
class ColumnsStop extends ContentElement
{
/**
* @var string Template
Expand All @@ -27,7 +33,7 @@ class ColumnsStop extends \ContentElement
*/
public function generate()
{
if (TL_MODE === 'BE') {
if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) {
return parent::generate();
}

Expand Down Expand Up @@ -61,13 +67,13 @@ public function generate()
*/
public function compile()
{
if (TL_MODE == 'BE') {
if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) {
$this->strTemplate = 'be_wildcard';
$this->Template = new \BackendTemplate($this->strTemplate);
$this->Template = new BackendTemplate($this->strTemplate);
$this->Template->title = $this->headline;
}
else {
$this->Template = new \FrontendTemplate($this->strTemplate);
$this->Template = new FrontendTemplate($this->strTemplate);
$this->Template->setData($this->arrData);
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/Resources/contao/dca/tl_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
* @author Martin Auswöger <[email protected]>
*/

if (TL_MODE === 'BE') {
use Contao\System;
use Symfony\Component\HttpFoundation\Request;

if (System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))) {
$GLOBALS['TL_CSS'][] = 'bundles/rocksolidcolumns/css/be_main.css';
}

Expand Down

0 comments on commit 8ca672a

Please sign in to comment.