Using title_format on relationship fields #678
-
DescriptionI have a question about title_formats on relationship fields such as HasMany. Is it possible to use a relations own relations in the title_format? For example: In this example, the Indicator model has two relations I'd like to use in the title formatting. For both release and country I'd like to use the "name" property. However, if I use {{ release:name }} or {{ country:name }} that area of the title remains blank. ( {{ release_id }} works fine in this example. It also seems to make no difference if I eager load the appropriate relations or not. Am I missing something, is something not working as intended, or is this the expected behaviour? EnvironmentPHP 8.3 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
At the moment, I believe it's just passing the model's attributes array to Antlers, not the augmented array (which would make relationships work). I'd accept a pull request to pass the model's Otherwise, you could probably workaround it for now by defining accessors on your model, and using them in your title format instead. |
Beta Was this translation helpful? Give feedback.
At the moment, I believe it's just passing the model's attributes array to Antlers, not the augmented array (which would make relationships work).
I'd accept a pull request to pass the model's
toAugmentedArray()instead.Otherwise, you could probably workaround it for now by defining accessors on your model, and using them in your title format instead.