-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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: Handle Empty State for KeyValueEntry #11129
Merged
danharrin
merged 4 commits into
filamentphp:3.x
from
jafar-albadarneh:fix/key-value-entry-empty-state#11127
Jan 29, 2024
Merged
fix: Handle Empty State for KeyValueEntry #11129
danharrin
merged 4 commits into
filamentphp:3.x
from
jafar-albadarneh:fix/key-value-entry-empty-state#11127
Jan 29, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Make sure to cast `null` to `[]` - Update `key-value-entry.blade` to check for the empty state and render an empty state label - Expose new method `emptyLabel()` to customize the placeholder text - Add necessary defaults for `emptyLabel` attribute - Update Docs
jafar-albadarneh
changed the title
feat: Handle Empty State for KeyValueEntry
fix: Handle Empty State for KeyValueEntry
Jan 28, 2024
- default to empty collection instead of `[]` for consistency
danharrin
reviewed
Jan 29, 2024
- remove state override method - handle `null` state override from within the template - update docs - update i18 refs
danharrin
reviewed
Jan 29, 2024
Thank you for picking up on our code style and structure, and trying to make this fit into the rest of the framework as well as possible. It is appreciated! |
Realised this is actually just placeholder() like the other entries, so renamed to that |
Makes complete sense |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently,
KeyValueEntry
handles empty arrays[]
asnull
state very well.The case happens when the model attribute is optional and its value is an empty array
[]
.More about the issue is described here
Before
After
Code style
composer cs
command has been run.Testing
Documentation