1

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 ?
kiamlaluno
  • 24,790
  • 16
  • 70
  • 85
夏期劇場
  • 15,969
  • 40
  • 121
  • 208

1 Answers1

0

Your opening a pretty serious api up with this. The base command is:

$data=field_info_instances("node",$source_node_type);

Fields are tied to entities. the argument's here are you asking for the fields attached to the "node" entity and the second argument is for the "node type" referred to in entity speak as the "bundle"

But it's a rather involved api. Check out the documentation for the entire api here: http://api.drupal.org/api/drupal/modules%21field%21field.module/group/field/7

danielson317
  • 2,684
  • 2
  • 18
  • 35