Repository navigation
fix: show the entity icon for a linked record without an image on view pages - #293
Merged
Merged
Conversation
This file contains hidden or 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
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.
A record-type field on a view page now shows its entity's icon when the linked record has no image, as the table column does since v3.18.1. Before, a company without a logo or a person without a photo showed only an underlined name in the infolist, beside native relation entries that did show an icon.
What changed
RecordEntry::formatRecord()adds theiconkeyRecordColumnalready returns: the entity icon when the entity has an avatar configuration and this record's image is blank.infolists/record-entry.blade.phpreplaces its two inline<img>blocks with thetables/columns/partials/record-avatarpartial from fix: pad the record column and show the entity icon for a record without an image #292. The partial draws the image, or else the 20px tile with a 12px entity icon in the avatar's shape.Why this way
The entry reuses the table's rule and partial, so a record looks the same in a table cell and on its parent's view page. Entities without an avatar configuration (notes, tasks) keep no tile, as in the table.
Behavior to know about
RecordEntryisfinalandformatRecord()is private, so the new state key reaches no consumer code. A consumer that copiedinfolists/record-entry.blade.phpintoresources/views/vendor/custom-fieldskeeps its copy and sees no change.Tests
tests/Feature/Filament/Components/RecordEntryTest.phprenders the custom-fields infolist inside a Livewire schema component:Checked
tests/Feature/Filament/Componentsandtests/Feature/Integration/Resources/Pages: 162 passed, 2 todo. Pint, Rector and PHPStan are clean.Not checked
The full suite runs in CI on this PR.