In Drupal 7, i need to Programmatically create the nodes, by using:

$node = new stdClass();
$node->type = "movie";

After, just this codes above, and lets assume i don't know what are the fields for it.

  • How can i get to know the fields and that field's structure for this Content Type?
  • (or) Can i echo out the fields inside a Content Type and its relations ?

1 Answer 1


field_info_instances(); will get you a list of all field types on a specific entity/bundle.

For example:

$fields = field_info_instances('node', 'movie');

Will give you a list of all available fields on the node type of movie.

Your Answer

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

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