firecmsco / firecms

Awesome Firebase/Firestore-based CMS. The missing admin panel for your Firebase project!
https://firecms.co
Other
1.14k stars 185 forks source link

reference with multiple collections #545

Closed ciriousjoker closed 1 year ago

ciriousjoker commented 1 year ago

We have a someRef property that can be either somecol1/docid or somecol2/docid.

We want to preview those documents based on a common map property "name" (specifically "name.en").

Current workaround:

Solution works but is obviously not optimal. I can't suggest a better solution though aside from "make it easier somehow" :D

fgatti675 commented 1 year ago

Mmm, you should be able to customise the preview properties of a ref: https://firecms.co/docs/properties/config/reference#previewproperties

I think you can customise those by using a PropertyBuilder, based on the value: https://firecms.co/docs/properties/conditional_fields

Let me know if that works

ciriousjoker commented 1 year ago

I didn't even know about the builders so far. Code is way cleaner now, thanks a lot! :)