Making a module with assignments like in the pages module
Created 7 years ago by dominique

Hello, I'm trying to make an addon for building portfolio cases. The user makes a new case which has a couple of properties like name and description. The user can then assign blocks to a case, such as a banner block or a video block.

The mechanism would be about the same as seen in the pages module, where a new page type can be made and every page type has multiple fields which can be sorted. I've tried to reverse engineer the module but haven't gotten far.

How would one go about making such a module?

Cheers

ryanthompson  —  7 years ago

You might be better off using something pre-built if at all possible.

Or, starting with an addon like Posts as it's a bit more trimmed down.

Any issues you are running into in particular?

dominique  —  7 years ago

I don't think such a module already exists. The main thing I'm running into is that I don't know how assignments work.

ryanthompson  —  7 years ago

Assignments are the relations between a field and a stream. When I do things like custom fields in modules I allow users to make fields that are UNLOCKED (see fields DB table). Then in a section handler or something I find all assignments that are for unlocked fields and put them in there.

The posts module is probably a better example of custom fields / the type pattern. Research that one a bit further.