Skip to content

Commit

Permalink
Merge pull request #5 from SalehHub/main
Browse files Browse the repository at this point in the history
Allow closure in setting the file url in infolists entry.
  • Loading branch information
joaopaulolndev authored Jul 11, 2024
2 parents 029deaf + b4ee622 commit 67a7988
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Infolists/Components/PdfViewerEntry.php
Original file line number Diff line number Diff line change
@@ -2,17 +2,18 @@

namespace Joaopaulolndev\FilamentPdfViewer\Infolists\Components;

use Filament\Infolists\Components\ViewEntry;
use Closure;
use Illuminate\Support\Facades\Storage;
use Filament\Infolists\Components\ViewEntry;

class PdfViewerEntry extends ViewEntry
{
protected string $view = 'filament-pdf-viewer::filament.components.infolists.pdf-viewer-entry';

protected string $minHeight = '50svh';

protected string $fileUrl = '';

protected string | Closure $fileUrl = '';
public function minHeight(string $minHeight): self
{
$this->minHeight = $minHeight;
@@ -25,7 +26,7 @@ public function getMinHeight(): string
return $this->minHeight;
}

public function fileUrl(string $fileUrl): self
public function fileUrl(string | Closure $fileUrl): self
{
$this->fileUrl = $fileUrl;

@@ -34,7 +35,7 @@ public function fileUrl(string $fileUrl): self

public function getFileUrl(): string
{
return $this->fileUrl;
return $this->evaluate($this->fileUrl);
}

public function getRoute(string $file)

0 comments on commit 67a7988

Please sign in to comment.