From 9b3ff54bf6d8833eeee6cc7553e0fbc95b9b17af Mon Sep 17 00:00:00 2001 From: Philipp Daun Date: Fri, 12 Jul 2024 21:50:37 +0200 Subject: [PATCH] [5.x] Display custom logo as plain text (#10350) --- config/cp.php | 2 ++ resources/views/partials/global-header.blade.php | 2 ++ resources/views/partials/outside-logo.blade.php | 2 ++ src/Http/View/Composers/CustomLogoComposer.php | 12 ++++++++---- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/config/cp.php b/config/cp.php index be058d6e9a..24f23edd95 100644 --- a/config/cp.php +++ b/config/cp.php @@ -139,6 +139,8 @@ 'custom_dark_logo_url' => env('STATAMIC_CUSTOM_DARK_LOGO_URL', null), + 'custom_logo_text' => env('STATAMIC_CUSTOM_LOGO_TEXT', null), + 'custom_favicon_url' => env('STATAMIC_CUSTOM_FAVICON_URL', null), 'custom_css_url' => env('STATAMIC_CUSTOM_CSS_URL', null), diff --git a/resources/views/partials/global-header.blade.php b/resources/views/partials/global-header.blade.php index 767d03a49f..23238c34a8 100644 --- a/resources/views/partials/global-header.blade.php +++ b/resources/views/partials/global-header.blade.php @@ -10,6 +10,8 @@ @if ($customLogo) + @elseif ($customLogoText) + {{ $customLogoText }} @else @cp_svg('statamic-wordmark', 'w-24 logo') @if (Statamic::pro()){{ __('Pro') }}@endif diff --git a/resources/views/partials/outside-logo.blade.php b/resources/views/partials/outside-logo.blade.php index bc92fb1e75..35f12a8438 100644 --- a/resources/views/partials/outside-logo.blade.php +++ b/resources/views/partials/outside-logo.blade.php @@ -2,6 +2,8 @@ @if ($customLogo) + @elseif ($customLogoText) +
{{ $customLogoText }}
@else @cp_svg('statamic-wordmark') @endif diff --git a/src/Http/View/Composers/CustomLogoComposer.php b/src/Http/View/Composers/CustomLogoComposer.php index f406afae87..54e75669cd 100644 --- a/src/Http/View/Composers/CustomLogoComposer.php +++ b/src/Http/View/Composers/CustomLogoComposer.php @@ -15,20 +15,24 @@ class CustomLogoComposer public function compose(View $view) { - $view->with('customLogo', $this->customLogo($view, false)); - $view->with('customDarkLogo', $this->customLogo($view, true)); + $view->with('customLogo', $this->customLogo($view)); + $view->with('customDarkLogo', $this->customLogo($view, dark: true)); + $view->with('customLogoText', $this->customLogo($view, text: true)); } - protected function customLogo($view, bool $darkMode = false) + protected function customLogo($view, bool $dark = false, bool $text = false) { if (! Statamic::pro()) { return false; } $config = config('statamic.cp.custom_logo_url'); - if ($darkMode && config('statamic.cp.custom_dark_logo_url')) { + if ($dark && config('statamic.cp.custom_dark_logo_url')) { $config = config('statamic.cp.custom_dark_logo_url'); } + if ($text && config('statamic.cp.custom_logo_text')) { + $config = config('statamic.cp.custom_logo_text'); + } switch ($view->name()) { case 'statamic::partials.outside-logo':