Fixed document color issue..

This commit is contained in:
Cüneyt Şentürk 2023-03-09 14:07:27 +03:00
parent a149b358a3
commit 62ccb79c2d
3 changed files with 29 additions and 13 deletions

View File

@ -974,15 +974,22 @@ abstract class Show extends Component
return $backgroundColor; return $backgroundColor;
} }
if ($background_color = config('type.' . static::OBJECT_TYPE . '.' . $type . '.color', false)) { // checking setting color
return $background_color; $key = $this->getSettingKey($type, 'color');
if (! empty(setting($key))) {
$backgroundColor = setting($key);
} }
if (! empty($alias = config('type.' . static::OBJECT_TYPE . '.' . $type . '.alias'))) { // checking config color
$type = $alias . '.' . str_replace('-', '_', $type); if (empty($backgroundColor) && $background_color = config('type.document.' . $type . '.color', false)) {
$backgroundColor = $background_color;
} }
$backgroundColor = setting($this->getSettingKey($type, 'color'), '#55588b'); // set default color
if (empty($backgroundColor)) {
$backgroundColor = '#55588b';
}
return $this->getHexCodeOfTailwindClass($backgroundColor); return $this->getHexCodeOfTailwindClass($backgroundColor);
} }

View File

@ -274,16 +274,22 @@ abstract class Template extends Component
return $backgroundColor; return $backgroundColor;
} }
if ($background_color = config('type.document.' . $type . '.color', false)) { // checking setting color
return $background_color; $key = $this->getSettingKey($type, 'color');
if (! empty(setting($key))) {
return setting($key);
} }
// checking config color
if (! empty($alias = config('type.document.' . $type . '.alias'))) { if (empty($backgroundColor) && $background_color = config('type.document.' . $type . '.color', false)) {
$type = $alias . '.' . str_replace('-', '_', $type); $backgroundColor = $background_color;
} }
$backgroundColor = setting($this->getSettingKey($type, 'color'), '#55588b'); // set default color
if (empty($backgroundColor)) {
$backgroundColor = '#55588b';
}
return $this->getHexCodeOfTailwindClass($backgroundColor); return $this->getHexCodeOfTailwindClass($backgroundColor);
} }

View File

@ -149,8 +149,11 @@ trait Documents
$prefix = config('type.document.' . $type . '.setting.prefix'); $prefix = config('type.document.' . $type . '.setting.prefix');
if (! empty($prefix)) {
$key .= $prefix . '.' . $setting_key; $key .= $prefix . '.' . $setting_key;
} else {
$key .= $setting_key;
}
return $key; return $key;
} }