I'm working on a module to implement parts of the SlideShare API. I have a new node type created with a 'textfield', 'file', and 'textarea' as input types on the create page. When I save the form, providing data in all fields, I get told that I'm not providing something in the file field. This is my first module, so I'd appreciate any help I can get. I'm also a little curious where $node->title, $node->body come from. I'm going on the basis that the member name is taken from the name in the $form array ($form['title'] = $node->title).

/**
* Implementation of hook_form().
*/
function slideshare_form(&$node) {
	$type = node_get_types('type', $node);
	
	$form['title'] = array(
		'#type' => 'textfield',
		'#title' => check_plain($type->title_label),
		'#required' => 'TRUE',
		'#default_value' => $node->title,
		'#weight' => -5
	);
	
	$form['file'] = array(
		'#type' => 'file',
		'#title' => check_plain('PowerPoint File'),
		'#required' => 'TRUE',
		'#default_value' => $node->file
	);
	
	$form['body_filter']['body'] = array(
		'#type' => 'textarea',
		'#title' => check_plain($type->body_label),
		'#required' => 'FALSE',
		'#default_value' => $node->body
	);
	
	$form['body_filter']['filter'] = filter_form($node->format);
	
	return $form;
} // function slideshare_form

Comments

neural’s picture

Maybe you should work with the Asset module team so as to bring Slideshare API support to Asset just as they did with Youtube.

I started a discussion on their project page on that:
http://drupal.org/node/293388