From 1fee8d0706cfd88d8b1509b44a5abf1eafc87b2e Mon Sep 17 00:00:00 2001 From: Cybrarist <38886749+Cybrarist@users.noreply.github.com> Date: Wed, 26 Feb 2025 14:07:27 +0400 Subject: [PATCH 1/2] - added text to custom logo ( it will look similar to github layout ) - added target=_blank to for custom logo --- resources/views/easy-footer.blade.php | 7 +++++-- src/EasyFooterPlugin.php | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/resources/views/easy-footer.blade.php b/resources/views/easy-footer.blade.php index 0dc5559..7b28a6c 100644 --- a/resources/views/easy-footer.blade.php +++ b/resources/views/easy-footer.blade.php @@ -55,9 +55,12 @@ @endif @if($logoPath) - + + @if($logoText) + {{ $logoText }} + @endif @if($logoUrl) - + @endif $this->showUrl, 'logoPath' => $this->logoPath, 'logoUrl' => $this->logoUrl, + 'logoText' => $this->logoText, 'logoHeight' => $this->logoHeight, 'borderTopEnabled' => $this->borderTopEnabled, 'loadTime' => $this->loadTimeEnabled ? $this->calculateLoadTime($startTime) : false, @@ -261,11 +264,12 @@ public function withLinks(array $links): static * @param string|null $url Optional URL for logo link * @param int $height Logo height in pixels (default: 20) */ - public function withLogo(string $path, ?string $url = null, int $height = 20): static + public function withLogo(string $path, ?string $url = null, string $text = null, int $height = 20): static { $this->logoPath = $path; $this->logoUrl = $url; $this->logoHeight = $height; + $this->logoText = $text; return $this; } From bd2a9dfeedf1b543a38171c4258a50620bd4325b Mon Sep 17 00:00:00 2001 From: Alexandre Date: Wed, 26 Feb 2025 20:13:30 +0100 Subject: [PATCH 2/2] Update readme and test --- README.md | 36 ++++++++++++++++++++++++---- src/EasyFooterPlugin.php | 9 +++++++ tests/Feature/FilamentPluginTest.php | 3 ++- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f281379..62ad494 100644 --- a/README.md +++ b/README.md @@ -238,24 +238,52 @@ use Devonab\FilamentEasyFooter\EasyFooterPlugin; ![Filament Easy Footer custom logo](https://raw.githubusercontent.com/Devonab/filament-easy-footer/main/art/custom_logo.webp) -You can add **custom logo** with link to the footer by using this configuration : +### Custom logo with link +![Filament Easy Footer custom logo](https://raw.githubusercontent.com/Devonab/filament-easy-footer/main/art/custom_logo.webp) + +You can add a **custom logo** with optional link and text to the footer by using this configuration: ```php use Devonab\FilamentEasyFooter\EasyFooterPlugin; ->plugins([ EasyFooterPlugin::make() - ->withLogo('https://static.cdnlogo.com/logos/l/23/laravel.svg', 'https://laravel.com') + ->withLogo( + 'https://static.cdnlogo.com/logos/l/23/laravel.svg', // Path to logo + 'https://laravel.com' // URL for logo link (optional) + ) ]) ``` -You're not obliged to add a link, and if you wish, you can specify the height of the logo as a parameter (default: 20px). +You can customize the logo further with optional text and height: + +```php +use Devonab\FilamentEasyFooter\EasyFooterPlugin; + +->plugins([ + EasyFooterPlugin::make() + ->withLogo( + 'https://static.cdnlogo.com/logos/l/23/laravel.svg', // Path to logo + 'https://laravel.com', // URL for logo link (optional) + 'Powered by Laravel', // Text to display (optional) + 35 // Logo height in pixels (default: 20) + ) +]) +``` + +If you don't need the link, you can pass `null` for the second parameter: + ```php use Devonab\FilamentEasyFooter\EasyFooterPlugin; ->plugins([ EasyFooterPlugin::make() - ->withLogo('https://static.cdnlogo.com/logos/l/23/laravel.svg', null, 60) + ->withLogo( + 'https://static.cdnlogo.com/logos/l/23/laravel.svg', // Path to logo + null, // No link + null, // No text + 60 // Logo height in pixels + ) ]) ``` diff --git a/src/EasyFooterPlugin.php b/src/EasyFooterPlugin.php index 1681da8..7281a43 100644 --- a/src/EasyFooterPlugin.php +++ b/src/EasyFooterPlugin.php @@ -262,6 +262,7 @@ public function withLinks(array $links): static * * @param string $path Path to the logo image * @param string|null $url Optional URL for logo link + * @param string|null $text Optional text to display before the logo * @param int $height Logo height in pixels (default: 20) */ public function withLogo(string $path, ?string $url = null, string $text = null, int $height = 20): static @@ -332,6 +333,14 @@ public function getLogoUrl(): ?string return $this->logoUrl; } + /** + * Get the logo text + */ + public function getLogoText(): ?string + { + return $this->logoText; + } + /** * Get the logo height */ diff --git a/tests/Feature/FilamentPluginTest.php b/tests/Feature/FilamentPluginTest.php index 2133c98..bb2309a 100644 --- a/tests/Feature/FilamentPluginTest.php +++ b/tests/Feature/FilamentPluginTest.php @@ -133,10 +133,11 @@ it('can add logo with URL', function () { $plugin = EasyFooterPlugin::make() - ->withLogo('/path/to/logo.png', 'https://example.com', 25); + ->withLogo('/path/to/logo.png', 'https://example.com', 'Something', 25); expect($plugin) ->getLogoPath()->toBe('/path/to/logo.png') + ->getLogoText()->toBe('Something') ->getLogoUrl()->toBe('https://example.com') ->getLogoHeight()->toBe(25); });