Skip to content

Commit

Permalink
fix php8 exception
Browse files Browse the repository at this point in the history
  • Loading branch information
vvohh committed Jul 12, 2022
1 parent feb54a7 commit b267eeb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [1.9.2] - 2022-07-12
- Changed: raise subcolumns dependency
- Fixed: avoid array offset on php8

## [1.9.1] - 2022-05-30
- Fixed: warning in php 8

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"php": "^7.1||^8.0",
"contao/core-bundle": "^4.4",
"heimrichhannot/contao-utils-bundle": "^2.16",
"heimrichhannot/subcolumns": "^3.1.8",
"heimrichhannot/subcolumns": "^4.0.0",
"symfony/http-kernel": "^3.4||^4.0||^5.0"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Backend/ColumnSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function appendColumnsetIdToPalette(\DataContainer $dc)
$arrDca['palettes']['colsetStart'] = str_replace('sc_name', '', $arrDca['palettes']['colsetStart']);
$arrDca['palettes']['colsetStart'] = str_replace('sc_type', 'sc_type,sc_name', $arrDca['palettes']['colsetStart']);

if ($content->sc_type > 0) {
if ($content && isset($content->sc_type) && $content->sc_type > 0) {
$arrDca['palettes']['colsetStart'] = str_replace('sc_type', 'sc_type,columnset_id,addContainer', $arrDca['palettes']['colsetStart']);
$arrDca['palettes']['colsetStart'] = str_replace('sc_color', '', $arrDca['palettes']['colsetStart']);
}
Expand Down
11 changes: 8 additions & 3 deletions src/Element/ColsetEnd.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ public function generate()
{

$arrColor = unserialize($this->sc_color);
if(count($arrColor) === 2 && empty($arrColor[1])) {
$arrColor = '';
} else {
$arrColor = $this->compileColor($arrColor);
}

if(!$GLOBALS['TL_SUBCL'][$this->strSet]['files']['css'])
{
$this->Template = new \BackendTemplate('be_subcolumns');
$this->Template->setColor = $this->compileColor($arrColor);
$this->Template->setColor = $arrColor;
$this->Template->colsetTitle = '### COLUMNSET START '.$this->sc_type.' <strong>'.$this->sc_name.'</strong> ###';

return $this->Template->parse();
Expand Down Expand Up @@ -50,7 +55,7 @@ public function generate()
$strMiniset .= '</div>';

$this->Template = new \BackendTemplate('be_subcolumns');
$this->Template->setColor = $this->compileColor($arrColor);
$this->Template->setColor = $arrColor;

$parent = \ContentModel::findByPk($this->sc_parent);

Expand Down Expand Up @@ -93,4 +98,4 @@ protected function compile()
}


}
}
9 changes: 7 additions & 2 deletions src/Element/ColsetPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ public function generate()
}

$arrColor = unserialize($this->sc_color);
if(count($arrColor) === 2 && empty($arrColor[1])) {
$arrColor = '';
} else {
$arrColor = $this->compileColor($arrColor);
}

if (!$GLOBALS['TL_SUBCL'][$this->strSet]['files']['css']) {
$this->Template = new \BackendTemplate('be_subcolumns');
$this->Template->setColor = $this->compileColor($arrColor);
$this->Template->setColor = $arrColor;
$this->Template->colsetTitle = '### COLUMNSET START ' . $this->sc_type . ' <strong>' . $this->sc_name . '</strong> ###';
#$this->Template->visualSet = $strMiniset;
$this->Template->hint = sprintf($GLOBALS['TL_LANG']['MSC']['contentAfter'], $colID);
Expand All @@ -59,7 +64,7 @@ public function generate()
$strMiniset .= '</div>';

$this->Template = new \BackendTemplate('be_subcolumns');
$this->Template->setColor = $this->compileColor($arrColor);
$this->Template->setColor = $arrColor;

$parent = \ContentModel::findByPk($this->sc_parent);

Expand Down
12 changes: 9 additions & 3 deletions src/Element/ColsetStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ public function generate()
{

$arrColor = unserialize($this->sc_color);
// avoid firing compileColor for php8 compatibility
if(count($arrColor) === 2 && empty($arrColor[1])) {
$arrColor = '';
} else {
$arrColor = $this->compileColor($arrColor);
}

if(!$GLOBALS['TL_SUBCL'][$this->strSet]['files']['css'])
{
$this->Template = new BackendTemplate('be_subcolumns');
$this->Template->setColor = $this->compileColor($arrColor);
$this->Template->setColor = $arrColor;
$this->Template->colsetTitle = '### COLUMNSET START '.$this->sc_type.' <strong>'.$this->sc_name.'</strong> ###';
$this->Template->hint = sprintf($GLOBALS['TL_LANG']['MSC']['contentAfter'],$GLOBALS['TL_LANG']['MSC']['sc_first']);

Expand All @@ -34,7 +40,7 @@ public function generate()
$GLOBALS['TL_CSS']['subcolumns'] = 'system/modules/Subcolumns/assets/be_style.css';
$GLOBALS['TL_CSS']['subcolumns_set'] = $GLOBALS['TL_SUBCL'][$this->strSet]['files']['css'] ? $GLOBALS['TL_SUBCL'][$this->strSet]['files']['css'] : false;

$arrColset = $GLOBALS['TL_SUBCL'][$this->strSet]['sets'][$this->sc_type];
$arrColset = !empty($this->sc_type) ? $GLOBALS['TL_SUBCL'][$this->strSet]['sets'][$this->sc_type] : '';
$strSCClass = $GLOBALS['TL_SUBCL'][$this->strSet]['scclass'];
$blnInside = $GLOBALS['TL_SUBCL'][$this->strSet]['inside'];

Expand All @@ -56,7 +62,7 @@ public function generate()
}

$this->Template = new BackendTemplate('be_subcolumns');
$this->Template->setColor = $this->compileColor($arrColor);
$this->Template->setColor = $arrColor;

if (($columnSet = ColumnsetModel::findByPk($this->columnset_id)) !== null) {
System::loadLanguageFile('tl_columnset');
Expand Down

0 comments on commit b267eeb

Please sign in to comment.