-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: text column placeholder #7439
fix: text column placeholder #7439
Conversation
This solves filamentphp#7401
PR Summary
|
Hey, where does |
I have tested this on my local dev machine. The
This is why it is wrapped in |
The issue is about ->formatStateUsing(fn ($state) => $state?->format('d F Y')) |
@ashleyhood I'm sorry I don't understand, a protected property should not be accessible in the view like that. Are you on the latest version? |
I'm on Filament v3.0.7 and Livewire v3.0.0-beta.7. That is really weird, because it does read the How would I track down where this is being set if it is not in the Would be helpful to have |
On second thoughts, isn't this okay to access the |
My bad 😕 This is not working as it is returning: Filament\Tables\Columns\TextColumn::placeholder(Closure|string|null $placeholder): static Which will always be true. We could only check for public function getPlaceholder(): string | Closure | null
{
return $this->placeholder;
}
and then check if it is `filled`. |
This will also need to be add to the InfoLists Should that be in a separate PR or could it be added to this PR? |
Yeah we can make a |
2a9a825
to
2a8e9af
Compare
@@ -37,6 +37,10 @@ | |||
} | |||
|
|||
$arrayState = \Illuminate\Support\Arr::wrap($arrayState); | |||
|
|||
if (blank($arrayState) && filled($getPlaceholder())) { | |||
$arrayState = \Illuminate\Support\Arr::prepend($arrayState, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this need to prepend the actual placeholder as state instead of an empty string? Also, can't it just reassign $arrayState
completely into a new array since its already blank, instead of prepending
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be an empty string because when we call formatState ()
on line 69 it expects a blank()
state:
if (blank($state)) { |
You are right about just assigning a new array and that makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use null
instead of an empty string please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially, we don't want the placeholder to run through formatState()
though 🤔 It might need different styling, for example. Maybe we should use an if statement in the view to decide whether or not to render a placeholder. And then remove the placeholder application from the formatState()
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that looking at how the placeholder is formatted might be for another PR?
This PR was about trying to address how a placeholder works as intended only if the state is an empty string but not if the state is null
.
I have removed the Arr::wrap that was evaluating |
This also brings up the fundamental difference between |
|
I see your point. Would you be happy to merge this fix and then another PR could address the issue of having a placeholder that accepted it's own styling. |
Any news about state of this PR? Maybe help needed? @danharrin |
Work needs to be done on it, but by the time I have time to write instructions I might as well do it myself |
Alright this should be fixed up now for all columns and entries, they have a differently-styled placeholder |
Please open an issue as I cannot reproduce it |
This solves #7401