diff --git a/app/Abstracts/View/Components/Documents/Show.php b/app/Abstracts/View/Components/Documents/Show.php index 96c7a617b..71a4cba51 100644 --- a/app/Abstracts/View/Components/Documents/Show.php +++ b/app/Abstracts/View/Components/Documents/Show.php @@ -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); } diff --git a/app/Abstracts/View/Components/Documents/Template.php b/app/Abstracts/View/Components/Documents/Template.php index fd5ec1281..3d5754fe0 100644 --- a/app/Abstracts/View/Components/Documents/Template.php +++ b/app/Abstracts/View/Components/Documents/Template.php @@ -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); } diff --git a/app/Traits/Documents.php b/app/Traits/Documents.php index 7dacef9cc..8192592f4 100644 --- a/app/Traits/Documents.php +++ b/app/Traits/Documents.php @@ -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; }