Here's some started code for a module that would enable an upload field on the node view page, enabling permissioned users to add files to the tree through Drupal. Any feedback on if I'm doing this right? I can't seem to get it to render on the page. I even tried to just attach some plain text to the #value field in the nodeapi hook, but it still didn't display. Could anyone point me in the direction of other examples of this I could compare mine to? Thanks a bunch! This will for sure be released back, so help me make it solid!

<?php

function filebrowser_up_nodeapi($node, $op, $a3, $a4) {
if($node->type == 'dir_listing' and $op == 'view') {
$node->content['filebrowser_up'] = array(
'#value' => theme('filebrowser_up_form', $node),
'#weight' => 9,
);
}
}

function theme_filebrowser_up_form($node){
return drupal_get_form('filebrowser_up', $node);
}

function filebrowser_up_form($node){
return 'Form Stuff Here';
}

Comments

brettev’s picture

I forgot the closing php tag so it didn't mark up right. Here it is correctly.


function filebrowser_up_nodeapi($node, $op, $a3, $a4) {
  if($node->type == 'dir_listing' and $op == 'view') {
    $node->content['filebrowser_up'] = array(
		'#value' => theme('filebrowser_up_form', $node),
		'#weight' => 9,
	);
  }
}

function theme_filebrowser_up_form($node){
	return drupal_get_form('filebrowser_up', $node);
}

function filebrowser_up_form($node){
	return 'Form Stuff Here';
}
cmgui’s picture

Yoran’s picture

Status: Active » Fixed

It's now integrated in RC8

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.