Skip to content

Commit e90bb9e

Browse files
committed
feat: add missing MediaGallery methods for thumbnailHeight, columns, orderable, preview
1 parent 23fd334 commit e90bb9e

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

src/Filament/Forms/Components/Concerns/HasMediaPreview.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ trait HasMediaPreview
1212

1313
protected int|Closure $previewWidth = 200;
1414

15+
protected int|Closure $thumbnailHeight = 150;
16+
17+
protected bool|Closure $preview = true;
18+
1519
public function previewConversions(array|Closure $conversions): static
1620
{
1721
$this->previewConversions = $conversions;
@@ -33,6 +37,20 @@ public function previewWidth(int|Closure $width): static
3337
return $this;
3438
}
3539

40+
public function thumbnailHeight(int|Closure $height): static
41+
{
42+
$this->thumbnailHeight = $height;
43+
44+
return $this;
45+
}
46+
47+
public function preview(bool|Closure $preview = true): static
48+
{
49+
$this->preview = $preview;
50+
51+
return $this;
52+
}
53+
3654
public function getPreviewConversions(): array
3755
{
3856
return $this->evaluate($this->previewConversions);
@@ -47,4 +65,14 @@ public function getPreviewWidth(): int
4765
{
4866
return $this->evaluate($this->previewWidth);
4967
}
68+
69+
public function getThumbnailHeight(): int
70+
{
71+
return $this->evaluate($this->thumbnailHeight);
72+
}
73+
74+
public function getPreview(): bool
75+
{
76+
return $this->evaluate($this->preview);
77+
}
5078
}

src/Filament/Forms/Components/Concerns/HasMediaUploadOptions.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ trait HasMediaUploadOptions
2020

2121
protected bool|Closure $allowBulkDelete = true;
2222

23+
protected array|Closure $columns = ['default' => 1];
24+
25+
protected bool|Closure $orderable = false;
26+
2327
public function acceptedFileTypes(array|Closure $types): static
2428
{
2529
$this->acceptedFileTypes = $types;
@@ -77,6 +81,20 @@ public function single(): static
7781
return $this;
7882
}
7983

84+
public function columns(array|Closure $columns): static
85+
{
86+
$this->columns = $columns;
87+
88+
return $this;
89+
}
90+
91+
public function orderable(bool|Closure $condition = true): static
92+
{
93+
$this->orderable = $condition;
94+
95+
return $this;
96+
}
97+
8098
public function getAcceptedFileTypes(): array
8199
{
82100
return $this->evaluate($this->acceptedFileTypes);
@@ -125,4 +143,14 @@ public function getAllowBulkDelete(): bool
125143
{
126144
return $this->evaluate($this->allowBulkDelete);
127145
}
146+
147+
public function getColumns(): array
148+
{
149+
return $this->evaluate($this->columns);
150+
}
151+
152+
public function getOrderable(): bool
153+
{
154+
return $this->evaluate($this->orderable);
155+
}
128156
}

0 commit comments

Comments
 (0)