Hallo, kann mir jemand helfen. Habe eine Fehlermeldung durch das Update auf 7.2
In einer Datei wird ein switch-Befehl genommen. Wie kann ich da eine Alternative einfügen?
Gruss
Frank
HTML-Code:
// Apply special formatting
switch ($arrField['sass']['format'])
{
case 'color':
$color = '';
if ($color = static::compileColor($varValue)){
$varValue = $arrField['sass']['name'] . ':' . $color . ';';
} else {
$varValue = '';
}
break;
case 'bottom-border':
$borderColor = '';
if($borderColor = static::compileColor($varValue)){
$varValue = $field['name'] . '{border-bottom: 1px solid ' . $borderColor . ';}';
} else {
$varValue = '';
}
break;
case 'image':
if ($GLOBALS['TL_DCA']['tl_themes4contao']['fields'][$strField]['inputType'] == 'fileTree' && $varValue)
{
$objFile = \FilesModel::findByPk($varValue);
if ($objFile !== null)
{
$varValue = $objFile->path;
}
else
{
$varValue = null;
}
}
if (strlen($varValue))
{
$varValue = $arrField['sass']['name'] . ':' . 'url("../../' . $varValue . '");';
}
break;
case 'trbl':
$value = deserialize($varValue);
if (is_array($value) && ($value['top'] != '' || $value['right'] != '' || $value['bottom'] != '' || $value['left'] != ''))
{
$top = intval($value['top']);
$right = intval($value['right']);
$bottom = intval($value['bottom']);
$left = intval($value['left']);
$borderradius = '';
// Try to shorten the definition
if ($top == $right && $top == $bottom && $top == $left)
{
$borderradius = $top . (($top === '0') ? '' : $value['unit']) . ';';
}
elseif ($top == $bottom && $right == $left)
{
$borderradius = $top . (($top === '0') ? '' : $value['unit']) . ' ' . $right . (($right === '0') ? '' : $value['unit']) . ';';
}
elseif ($top != $bottom && $right == $left)
{
$borderradius = $top . (($top === '0') ? '' : $value['unit']) . ' ' . $right . (($right === '0') ? '' : $value['unit']) . ' ' . $bottom . (($bottom === '0') ? '' : $value['unit']) . ';';
}
else
{
$borderradius .= $top . (($top === '0') ? '' : $value['unit']) . ' ' . $right . (($right === '0') ? '' : $value['unit']) . ' ' . $bottom . (($bottom === '0') ? '' : $value['unit']) . ' ' . $left . (($left === '0') ? '' : $value['unit']) . ';';
}
$varValue = $arrField['sass']['name'] . ':' . $borderradius;
}
else
{
$varValue = null;
}
break;
case 'value':
if (strlen($varValue)){
$varValue = $arrField['sass']['name'] . ':' . $varValue . ';';
} else {
$varValue = '';
}
break;
case 'height':
if (strlen($varValue)){
$varValue = $arrField['sass']['name'] . ':' . $varValue . 'px;';
} else {
$varValue = '';
}
break;
case 'border-bottom':
$color = '';
if ($color = static::compileColor($varValue)){
$varValue = $arrField['sass']['name'] . ': 1px solid' . $color . ';';
} else {
$varValue = '';
}
break;
case 'unit':
$value = deserialize($varValue, true);
if (!strlen($value['value']))
{
$varValue = null;
}
else
{
$varValue = $arrField['sass']['name'] . ':' . $value['value'] . $value['unit'] . ';';
}
break;
case 'page-margin':
$value = deserialize($varValue, true);
if (is_array($value) && ($value[0] != '' || $value[1] != ''))
{
$varValue = $arrField['sass']['name'] . ':' . intval( $value[0] ) . 'px auto ' . intval( $value[1] ) . 'px auto;';
}
else
{
$varValue = null;
}
break;
case 'content-padding':
$value = deserialize($varValue, true);
if (is_array($value) && ($value[0] != '' || $value[1] != ''))
{
$varValue = $arrField['sass']['name'] . ':' . intval( $value[0] ) . 'px 0 ' . intval( $value[1] ) . 'px 0;';
}
else
{
$varValue = null;
}
break;
case 'content-width':
if ($varValue){
if ($varValue < 970){
$varValue = '$mediumWidth:' . $varValue . 'px;' . $arrField['sass']['name'] . ':' . $varValue . 'px;';
} else {
$varValue = $arrField['sass']['name'] . ':' . $varValue . 'px;';
}
} else {
$varValue = '';
}
break;
}
if ($varValue){
$arrVariables[] = $varValue;
}
}
return array_filter($arrVariables);
}
/**
* Replace the config tags
* @param string
* @return mixed
*/
public function replaceConfigTags($strTag)
{
$arrTag = explode('::', $strTag);
if ($arrTag[0] == 't4c')
{
$varValue = static::get($arrTag[1], true);
// Format the value
switch ($arrTag[2])
{
case 'image':
if (is_file(TL_ROOT . '/' . $varValue)) {
$imgSize = @getimagesize(TL_ROOT . '/' . $varValue);
$varValue = \Image::getHtml(\Image::get($varValue, $imgSize[0], $imgSize[1]));
}
break;
}
return $varValue;
}
return false;
}
Lesezeichen