I am interested in starting a new project with Kirby but am already wondering if what I would need to do is possible.
One basic wall I seem to be running into already is the need to associate a number of team members and their roles in a project. Team members would need to be selected via a searchable relationship, and then their role for the particular project entered as plaintext:
Combing Wordpress with ACF, I would simply use a Repeater Field with a Relationship and a Text field.
If I understand correctly, would something like this be possible in Kirby by using the relationship field plugin combined with a structure field?
I’m not entirely sure if I’m wrapping my head around this correctly.
I’m not so sure about the relationship field but would probably rather go for the quick select field in combination with a structure field? Are the team members users or pages? In case of pages, a page field might be sufficient.
I’ld like to point out that in case of “updates” or “deletes” the “linked values” in your structure field won’t reflect those changes. You’ld need to code a plethora of hooks for this if you’ld want to keep this in sync.
E.g. you create a structure with a page field (as texnixe suggests): when you reference a page via that page field it’ll save the URI of that page (e.g. some/page/path). When the URI of the linked page changes (e.g. some/updated-page/path), that new URI won’t be updated automatically in your structure.
Depending on your use case, it might be valuable to take this into consideration.
Edit: not tested, but maybe if you use the auto-id plugin to save as “reference”, the above is “solved” as an ID is unlikely to change (a bit as a primary key in a table).
@bvdputte True, these are all potential issues that need to be taken into account. I think, there are several ways to work around this issue:
- Prevent deleting and renaming of these references
- Save a unique ID instead of the page URI
- Store the name of the person, so that you could still print it even if. the link to the page/user doesn’t exist anymore.
The best solution really depends on the use case, if it is likely that people will be removed or moved etc.
Thank you everyone for the prompt and thoughtful responses. In a Wordpress context, the people would be custom post types. In my use case, it’s not too likely that they would be moved or removed and so on but it’s important that the references remain connected as it’s more of an archive.
For example, it would be important to be able to reference the person and find which projects they are associated with, or even something more complicated like
Find projects that PersonA and PersonB worked on, so definitely the connection to the unique ID would be important.
I’m getting a bit concerned that for a use case with a lot of complex relationships and queries, that Kirby is not 100% appropriate, but was also thinking that if I gain a better understanding of how things work, I could build something more bespoke. The only thing is that everything comes out of the box with ACF.
It’s hard to tell without knowing how big your project is going to be. Complicated queries are no problem, but they don’t come out of the box, or rather, Kirby provides all the methods you need to make this no big problem, but nevertheless, you would have to implement your logic.
Adding a unique read-only ID to a page can be automated, but if user pages do not get renamed, this might not even be necessary (but in any case it doesn’t hurt). If users are Panel users instead of pages, the user name would be your unique ID.
Another option would be an additional database for the users, but that would require some extra coding.
I guess you have reasons to consider Kirby instead of using Wordpress? I’d love to hear them.
I am indeed wondering if it’s more just about learning to do things in more of a Kirby way than Wordpress, but there would just need to be several many-to-many relationships built throughout the site, such as:
So it would be necessary to be able to build a panel UI for the client to select all the relationships, and for these references to remain up to date.
My main issue with Wordpress is that it tended to create a lot of anxiety regarding maintenance, but as I’ve moved towards using Wordpress only as a CMS/JSON endpoint, it’s been less of a headache. Also, the development workflow with Wordpress leaves a lot to be desired. For issues with dev/production deployment etc too, it would be so much less of a headache not to deal with a DB.
I’ve heard very excellent things about Kirby through peers, so I was wondering if it would be a suitable alternative.
Kirby has a lot of stuff right. It’s awesome to work with and to develop in. Not having to deal with a database is great, but sometimes it can be a challenge to get things what databases have built in. In your case this is is referencing content to eachother and keep it referenced (the “foreign-key” idiom).
It can be done though. You’ld need a way to make your items (pages, users, …) unique. The before-mentioned autoid can help you with that.
But then you’ld also need a field, with UI, which can reference items using those unique id’s. Try to use core fields which have “dynamic query” options built in (such as the select field or checkboxes field), and use
Do read up on the issues in the autoid plugin, as I read it has some quirks in multilang setups apparently. But maybe you can contribute some help to fix that if you need it