eval helper text as parent component

This commit is contained in:
Dan Harrin
2025-06-15 16:10:02 +01:00
parent e2b8c3f242
commit df126ff073
2 changed files with 4 additions and 2 deletions
@@ -3,6 +3,7 @@
namespace Filament\Forms\Components\Concerns;
use Closure;
use Filament\Schemas\Components\Component;
use Filament\Schemas\Components\Text;
use Illuminate\Contracts\Support\Htmlable;
@@ -10,7 +11,7 @@ trait HasHelperText
{
public function helperText(string | Htmlable | Closure | null $text): static
{
$this->belowContent(Text::make($text));
$this->belowContent(fn (Component $component): Text => Text::make($component->evaluate($text)));
return $this;
}
@@ -3,6 +3,7 @@
namespace Filament\Infolists\Components\Concerns;
use Closure;
use Filament\Schemas\Components\Component;
use Filament\Schemas\Components\Text;
use Illuminate\Contracts\Support\Htmlable;
@@ -10,7 +11,7 @@ trait HasHelperText
{
public function helperText(string | Htmlable | Closure | null $text): static
{
$this->belowContent(Text::make($text));
$this->belowContent(fn (Component $component): Text => Text::make($component->evaluate($text)));
return $this;
}