Repository navigation
[9.x] Fix nested JSON fields in title_field and title_format - #844
Merged
Merged
Conversation
every `title_field` consumer read the value with `getAttribute()` or magic property access, both of which return null for a nested handle like `metadata_sku`. adds `getValueForField()` as the read-side counterpart to `getColumnForField()` and routes titles through it. query-side paths (sorting in the stack selector, the relationship filter, `runwaySearch`, `DuplicateModel`) now convert the handle to a column. also fixes `AugmentedModel::wrapNestedField()` deriving the prefix with `Str::before($handle, '_')`, which returned null for any prefix containing an underscore. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
duncanmcclean
marked this pull request as draft
August 3, 2026 10:38
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014CMma1jbzQJrxE5vmRhVpH
duncanmcclean
marked this pull request as ready for review
September 4, 2026 09:08
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014CMma1jbzQJrxE5vmRhVpH
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014CMma1jbzQJrxE5vmRhVpH
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014CMma1jbzQJrxE5vmRhVpH
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014CMma1jbzQJrxE5vmRhVpH
|
Released as part of v9.7.0. |
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.
This pull request fixes an issue where the
title_fieldresource option and thetitle_formatfieldtype option couldn't reference fields nested inside JSON columns.This was happening because every consumer of
title_fieldread the value with$model->getAttribute($titleField)or magic property access, both of which returnnullfor a nested handle likeaddress_street_name. The one place it did work was the relationship fieldtype's selected items, which resolve the title through augmentation instead.The issue also asked which syntax is correct, so for the record: it's the nested handle (
address_street_name), same as anywhere else in a blueprint. The arrow form (address->street_name) is the database column Runway generates internally, and was never a valid blueprint handle — which is why the listing title rendered but didn't link.This PR fixes it by adding
getFieldValue()to theHasRunwayResourcetrait as the read-side counterpart togetFieldColumn(), then routing titles through it: listings, the edit form, publish form values, revisions, search results and relationship columns. Query-side paths now convert the handle to a column, so sorting in the stack selector, the relationship filter,runwaySearchand duplication work with a nested title field too.This PR also fixes:
external_links) always augmenting tonull, sinceAugmentedModelderived the prefix withStr::before($handle, '_'). This affectstitle_format, which reads values through augmentation.runwaySearchentirely, since the "does this map to a real column?" check tested the field handle instead of the column it maps to.fieldsbeing indexed asnull, sinceSearchablealso read them with magic property access.While here,
getColumnForField()has been renamed togetFieldColumn()to match. The old name still works, but is deprecated.The docs for both options have been updated to mention nested fields.
Fixes #703