Hi - I need to get the list of Allow Values in a Select or Other field. They're not showing up in field_info_fields();

Where's this data stored? How can I retrieve it?

thanks

Comments

haydeniv’s picture

The data is stored in the widget info not the field info. Accessing it depends on when you want to get the data. Is this is a form alter, or on the display side, or just informational?

steveixa’s picture

it's informational. I need to generate a report using those fields as an axis on a graph, i.e. graph of the number of nodes with each option selected.

haydeniv’s picture

I think I'd just do a distinct sql query against your field in the field_data_field_your_field_name table.

Because it is stored in the widget settings you'd have to fake a form and then extract the widget values out but that would be a bit tricky I think. I'm pretty sure the actual data is stored in a blob in field_config_instance but that would be really messy to get at. The available options are distinct per field so you would need to try and discover each field that uses a select_or_other widget to pull it out.

steveixa’s picture

ok - thanks @haydeniv. I'll give it a try.

Raphael Apard’s picture

I was looking for a module like select_or_other but with a field with same functionalities as core "list_text" field, so i wrote a sandbox : https://www.drupal.org/sandbox/wdki/2365003

legolasbo’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.