#1 April 27, 2012 6:58am

philp
Member
Registered: April 5, 2012
Posts: 25

Enhancing `Array of Items` field

I've been working on some enhancements to the built-in `Array of Items` field type, providing the ability to define the field types of each field. I started work on this because I wanted to be able to add multiple occurrences of dates and times to an `Event` module.


the changes are quite simple: when setting options on the Array field there is now an option to choose the field type alongside each key-value pair. Then, when adding/editing an item in the array, the appropriate input type is displayed.


It's still a little rough around the edges, but I wondered whether this was functionality you were planning to develop in the future and/or whether you'd like me to contribute what I've done?

Offline

#2 April 27, 2012 11:54am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 949

Re: Enhancing `Array of Items` field

That's a great idea that we'll try to get into beta 4.  Ben's going to work on the UI (which I think is the biggest challenge to having different field types inside an array of items).  We'll need to limit what field types you assign to the different elements of the "Items" but we'll be sure to get date/time and all the basics in there!

We're always up for seeing what other people have done as different perspectives on the same problem are always valuable so if you want to make a branch with your changes in it that would be great.  If you want to sit back and wait for beta 4 with the feature that would be fine as well, of course smile

Offline

#3 April 30, 2012 6:11am

philp
Member
Registered: April 5, 2012
Posts: 25

Re: Enhancing `Array of Items` field

Great!

I will tidy up what I've done so far and submit a branch with the changes soon. The logic I sued proved to be very simple, simply adding the field type in the meta data and then making a few adjustments to the way the dialogs are displayed.

Offline

#4 May 23, 2012 5:55am

philp
Member
Registered: April 5, 2012
Posts: 25

Re: Enhancing `Array of Items` field

Ive' not had much time to look at committing what I've done on this so far, but will try to do so as soon as I can.


One thought which has occurred to me while thinking about use cases for this though: how practical do you think it would be to use related tables for storing the data for this type of field?


The reason I suggest this is because I was looking at using it for adding `Event` instances (so an event could be happening on any number of dates/times). But I'd then want to be doing a query to filter and sort on these `instances` (for a calendar view for example).


M2M fields don't really cut it for this use case, as I can't create them inline, on-the-fly.

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.