How can I use recordfinder widget with tailor model?
comment:
label: Coment
type: recordfinder
list: ~/plugins/rainlab/user/models/user/columns.yaml ?? what comes here instead???????
recordsPerPage: 10
title: Find a Comment
nameFrom: title
useRelation: false
modelClass: RainLab\User\Models\User ?? what comes here instead?????
Thank you,
Zs
Also, consider making your own content field for this:
Then register it as a rainlabuser type, which renders as a recordfinder and adds a comment_id column to the table.
comment:
label: Comment
type: rainlabuser
This file shows an example, although it is more complicated since it handles many different possibilities: modules/tailor/contentfields/EntriesField.php
What you have proposed will work, but save the related ID as a text field. It won’t generate a relationship at the model level. Tailor needs to know about the relationship type, which is programmed using a tailor content field (as mentioned).