Skip to content

[WIP] Fix nested fields in title_format/title_field options#780

Closed
Copilot wants to merge 1 commit into
9.xfrom
copilot/fix-nested-title-field-issues
Closed

[WIP] Fix nested fields in title_format/title_field options#780
Copilot wants to merge 1 commit into
9.xfrom
copilot/fix-nested-title-field-issues

Conversation

Copilot AI commented Feb 18, 2026

Copy link
Copy Markdown

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>Can't use title_format/title_field options with nested fields</issue_title>
<issue_description>### Description

Not sure what the right way of configuring a nested title_field (ie, from a JSON column) is supposed to be, but both approaches break in different locations—using a has_many in the examples below. Maybe a good thing to note in the docs, assuming only one of these is the right way? Here's what I'm seeing:

'title_field' => 'meta->name'

When using the arrow syntax...

  • Listings are broken (ie, title field shows, but is unlinked):
    Image
  • Relationships work (ie, links are present, to the record's edit form):
    Image

'title_field' => 'meta_name'

When using the underscore syntax...

  • Listings work (ie, links are present, to the record's edit form):
    Image
  • Relationships are broken (ie, records are missing a title altogether—in the edit form, and when shown as a listing column):
    Image

Steps to reproduce

  1. Add a meta column to a resource
  2. Add a has_many field to the blueprint of a parent resource
  3. Set a nested JSON field as the title_field in Runway config
  4. Switch between using -> or _ syntax for the title_field
  5. Note what breaks/works, as outlined above, after switching

Environment

Environment

Application Name: Statamic
Laravel Version: 12.20.0
PHP Version: 8.4.10
Composer Version: 2.8.8
Environment: local
Debug Mode: ENABLED
URL: samplesite.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Storage
A:\www\samplesite\public\storage: NOT LINKED

Livewire
Livewire: v3.6.3

Statamic
Addons: 7
Sites: 3 (Fraternity, Foundation, Housing)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.60.0 PRO

Statamic Addons
caseydwyer/statamic-long-range: dev-main
doefom/currency-fieldtype: 1.4.1
eminos/statamic-tabs: 1.2.0
jacksleight/statamic-miniset: 1.3.0
marcorieser/statamic-livewire: 4.5.2
statamic-rad-pack/runway: 8.5.2
statamic/seo-pro: 6.7.0

Comments on the Issue (you are @copilot in this section)

@duncanmcclean Ahh, I don't think I ever thought about using the `title_field` setting with a JSON/nested field. We'll need to add special handling for it.

In the meantime, you could probably add an Eloquent accessor to your model and use that as your title field:

public function runwayTitle(): Attribute
{
    return Attribute::make(
        get: fn () => $this->meta['role_name'] ?? null,
    );
}
```</body></comment_new>
</comments>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@duncanmcclean

Copy link
Copy Markdown
Member

@copilot Try again please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't use title_format/title_field options with nested fields

2 participants