Let the user choose the field type I'm working on a drupal project and part of it is a sort of "tile overview" page. Its a 3x? grid, with a variable length.
|--|--|--|
|--|--|--|
|--|--|--|
|--|--|--|
 .. .. ..
Sort of like that, I hope you can tell what I'm trying to describe.
Each row of 3 is a field_collection.
Now, each field can be either an image field or a text field. I want the user to be able to choose. How would I implement such a feature?
My solution as of now is to have 6 fields per row: one image field and one text field per each single field. Then the user would be told to only fill in one. If he fills in both, one of them gets ignored (php: isset() priority). Obviously this is far from optimal. What I'm looking for is like a radio button functionality so that when the user has a value set for one of the two possible field types, the other one gets disabled. Or just let the user decide first which he wants and then only display that one.
Help would be much appreciated.
Check this module:

Conditional Fields

This module lets you to set things such a visibility, depending on other form elements. 

It works based on Drupal's States API ( which you could also use in your custom module to achieve what you want )