Variable number of fields in content...

Sep 24, 2014 at 1:43 PM
I just wonder if there is a way to let the editor 'add' a field on demand.

In my case i've created a simple app which allows the editor to display in this case a 'Event' Content-Type. So far the Editor can add a fixed count only of images with a description.
It would be nice if there was the option to 'ADD' any further Image/description entity with for instance a buttonclick.

I've uploaded this screencast for a better understanding:
Screencast

Also the designprocess of the 'Event'-ContentType in this case with 12'slots' is pretty cumbersome, of course.

Are there better ways to solve this approach?

thank you and greetz
roxl
Coordinator
Sep 24, 2014 at 2:02 PM
@roxl
Thanks for the great video :)

Yes, there is a much better way to do this... :)

In short: create a content type just for 1 image, approx. like
  • Title (text, 1 line)
  • Image (file, image, always pointing to some folder for the news-images)
  • ...any additional fields
    ...and call it "NewsImage"
Then in your news content-type, create 1 Field!
  • Images (or Bilder) which is an Entity-type. Configure it to allow multiple items and only of the type "NewsImage"
...and that's it!

Thanks to sponsoring by @nokiko, you can even sort these :)

The output template will have to be changed a bit - look at some samples...

documentation is a bit sparse: http://2sxc.org/en/Docs-Manuals/Relationship-Management-connecting-Entities
Sep 24, 2014 at 2:09 PM
@roxl

Well I can delete most of my answer now :)

you will then get a dropdown showing the title field from your entity as well as a "-new-" option, clicking this will open the input form for the entity "NewsImage" ( directly adding also sponsored by me :). After its added here it will redraw and you will see this in the dropdown as well ( note: this is not auto selected yet )
Sep 24, 2014 at 2:32 PM
Sounds very promising. I'll look at it.

Thanks for your answers.
Sep 27, 2014 at 3:44 PM
Edited Sep 27, 2014 at 4:03 PM
I've just tried it out and wanna give some feedback.

Your suggestion works well. Especially if the 'nested' entity contains reusable Content. Like skills of a Person, for example.
However, in my case each entity (or Image) is always associated with only one Evententity. So after creating 10 Events with 10 Pictures each
the Editor must already consider a very good naming convention to safeguard the overview in a list of 100 or more entries.
In particular because auto selection of the new created entity is not supported yet.

But hey, also a great solution does not cover all Scenarios at once ;)

Thank you.
roxl