I got the all node type list in a variable using get_node_type_info() and now am passing this variable to field_info_instances as:

array_keys(field_info_instances("node", $op_keys));

ps: $op_keys is the variable to get node types. But this is giving me list of node_type "keys" and I want field "keys".

Either tell:

(1)how to pass list of all node types as a $bundle_name in field_info_instances() ?


(2) when selecting any of the node_type (as an option of select list) from select list, it's corresponding field's name will get rendered. I mean to say for example: node_type = "Article" and its field names = "body", "title", "image". when "article" got clicked from select list, "body", "title", "image" should get rendered.

2 Answers 2


Try field_read_fields you should be able to request keys as a parameter in argument 1. And then for the conditions in argument 2 limit the fields returned by the inquiry by supplying entity and bundle keys to limit how many fields you get back. You may get back the fields used in the bundle -- but it should include the keys value.


To get a list of field names for each content type,, stored in a variable "list", given an array of bundle names, you could do: $list = array(); foreach($bundle_names as $bundle){ $list[$bundle] = array_keys(field_info_instances('node', $bundle)); } Hope that helps.

  • it is giving me only only first name of field on every select. not working Jul 14, 2015 at 14:49
  • Not sure I understand. What does "first name of field" mean? It gives you a list of machine names for each field, keyed by the bundle name for each content type
    – Ollie
    Jul 14, 2015 at 14:51
  • 1
    @SuagndhKhanna This is the correct solution to (1) in the original post. You can't pass multiple bundle names to field_info_instances. You can only pass 1. Therefore you loop through your bundles like Ollie showed you how to.
    – Beebee
    Jul 14, 2015 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.