jantimon
jantimon

Reputation: 38142

How to get all content types having a certain field programmatically in Drupal 7?

I want to list all content types (not nodes) that have a special field for example "field_user_select". How do I do this programmatically in drupal 7?

Thanks

Upvotes: 2

Views: 1437

Answers (2)

Berdir
Berdir

Reputation: 6891

You should be able to use field_read_instances to return all field instances of a given field_name. From that, get the entity bundles.

Upvotes: 3

Nikit
Nikit

Reputation: 5128

I didn't found correct function, but you can create own function, take code from function field_ui_fields_list() in field_ui.admin.inc file, add argument for filtering by field name...

Upvotes: 1

Related Questions