Hi,
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
1 Like
But there is no any relation. I would like to use this recondfinfer in a static block.
If I would like to find my own plugin’s record, it is working properly.
annual_report:
label: Report
type: recordfinder
list: ~/plugins/yuppi/annualreports/models/report/columns.yaml
recordsPerPage: 10
title: Find report
nameFrom: title
useRelation: false
modelClass: Yuppi\AnnualReports\Models\Report
Is there any example code, how to do this, or what are the steps if I have a tailor model, instead of own plugin model.
Thanks,
Zs
@daftspunk are you planning to extend recordfinder plugin to work with new Tailor model?
Thank you,
Zs
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).
Hopefully, this makes sense.