views:

37

answers:

3

I'm adding new content to a node, but I'm stuck on what to put in #type. I know that when you're dealing with a profile page for example, you would put

'#type' => 'user_profile_item'

but what to put for new content on a node?

$node->content['newc'] = array(
    '#type' => ,                 //what to put here for type
    '#title' => t('New'),
    '#value' => $newc,
}
+2  A: 

Is this supposed to be a form field, such as a textbox? If so, you can use this: 'textfield'

If this isn't a field for a user to complete, but just a way to insert new content into the database with code, I'm not sure what it should be. In that case, you might want to not set the type at all and see if it works.

Dylan West
+3  A: 

That would be the node type. You can find this out by going to the content types edit page for that type of node. It's under a field called machine readable name or something like that. It's basically the kind of content you are creating; page, article, product, image etc.

For example if you had a content type 'Motor Vehicles' the node type might be 'motor_vehicles' as you cannot use spaces.

Keyo
+2  A: 

If you want something displayed on the node page with a title, you'll likely want to use '#type' => 'item'. Otherwise just to display some kind of output/markup the only thing you need is '#value' => 'the html or theme output here'.

Dave Reid