[development] How to populate a content type programmatically - D7

Emma Irwin emma.irwin at gmail.com
Sun Jul 24 16:15:06 UTC 2011


Assuming I understand ...
You should know what your node object for the given content type looks like when populated.
You'll then assign programmatically as you suggest. I am not sure what you mean by rebuilding  -  once your node is constructed node_save() will do what you need



On Jul 23, 2011, at 11:26 AM, Ernst Plüss <ernst.pluess at gmail.com> wrote:

> Hi Drupal friends
> 
> In a cron job I'm loading data from an external source and want to
> create nodes of a content type created with fields in D7.
> 
> For every node I do:
> 
> $node = new stdClass();
> // populate field values
> node_save($node);
> 
> How can I populate the filed values programmatically ? Is there
> something in Field API that does this for me or do I have to rebuild
> the whole complicated fields structure for every field by hand? Or is
> there something that can prepare this structure in order I can fill in
> my values?
> 
> Thanks for your help!
> Ernst


More information about the development mailing list