I believe the Example module includes a complete example of the block stuff.
You will also need hook_block_info() (http://api.drupal.org/api/drupal/modules--block--block.api.php/function/hook_block_info/7) in order for the blocks to show up in the blocks list. Then your hook_block_view() (http://api.drupal.org/api/drupal/modules--block--block.api.php/function/hook_block_view/7) will work to generate it.

You might also be interested in http://drupal.org/coding-standards
 
Nancy

Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.


From: Iain William Wiseman <iwiseman@bibble.co.nz>
To: support@drupal.org
Sent: Wednesday, October 5, 2011 3:51 PM
Subject: Re: [support] Forms in blocks

On 6/10/2011 2:28 a.m., Ms. Nancy Wichmann wrote:
"Created all my forms..." How did you create them? If they are in a module, why not add a simple hook_block() [or the D7 equivalents]? It looks like the formblock module probably does that with some fancy wrapping stuff.
 
Nancy
 
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.

Thanks Nancy,

They are in a module. I googled for some time and came across

http://stackoverflow.com/questions/1450941/inserting-a-form-into-a-block-in-drupal

Which suggested

function yourmodule_block_view($delta='')
{
  switch($delta) {
    case 'your_block_name':
      $block['subject'] = null; // Most forms don't have a subject
      $block['content'] = drupal_get_form('yourmodule_form_function');
      break;
   }
   return $block;
 }

However I have done that for one of my simple forms and cannot see it appear under block.

Assume I am an idiot when replying because it might be me being really silly. :-)

Thanks as always for your help. I have come a long way over the last six months thanks to the support of this forum.

Iain

--
[ Drupal support list | http://lists.drupal.org/ ]