From 0d1fdf5e129383cbcb446ee1c2db2ad6b4d0482d Mon Sep 17 00:00:00 2001 From: Gerardo Ibarra Date: Sat, 2 Nov 2024 13:00:47 -0300 Subject: [PATCH] Improve tags (using filament translations) --- src/SelectTree.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SelectTree.php b/src/SelectTree.php index e2eda72..9991136 100644 --- a/src/SelectTree.php +++ b/src/SelectTree.php @@ -36,8 +36,6 @@ class SelectTree extends Field implements HasAffixActions protected bool $alwaysOpen = false; - protected string $emptyLabel = ''; - protected bool $independent = true; protected ?string $customKey = null; @@ -136,6 +134,8 @@ protected function setUp(): void return $component->getCustomKey($record); }); + $this->placeholder(static fn (SelectTree $component): ?string => $component->isDisabled() ? null : __('filament-forms::components.select.placeholder')); + $this->suffixActions([ static fn (SelectTree $component): ?Action => $component->getCreateOptionAction(), ]); @@ -336,7 +336,7 @@ public function expandSelected(bool $expandSelected = true): static public function emptyLabel(string $emptyLabel): static { - $this->emptyLabel = $emptyLabel; + $this->noSearchResultsMessage($emptyLabel); return $this; } @@ -457,7 +457,7 @@ public function getDefaultOpenLevel(): int public function getEmptyLabel(): string { - return $this->emptyLabel ? $this->evaluate($this->emptyLabel) : __('No options match your search.'); + return $this->getNoSearchResultsMessage(); } public function getDirection(): string