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;
}
if ($background_color = config('type.' . static::OBJECT_TYPE . '.' . $type . '.color', false)) {
return $background_color;
// checking setting color
$key = $this->getSettingKey($type, 'color');
if (! empty(setting($key))) {
$backgroundColor = setting($key);
}
if (! empty($alias = config('type.' . static::OBJECT_TYPE . '.' . $type . '.alias'))) {
$type = $alias . '.' . str_replace('-', '_', $type);
// checking config color
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);
}

View File

@ -274,16 +274,22 @@ abstract class Template extends Component
return $backgroundColor;
}
if ($background_color = config('type.document.' . $type . '.color', false)) {
return $background_color;
// checking setting color
$key = $this->getSettingKey($type, 'color');
if (! empty(setting($key))) {
return setting($key);
}
if (! empty($alias = config('type.document.' . $type . '.alias'))) {
$type = $alias . '.' . str_replace('-', '_', $type);
// checking config color
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);
}

View File

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