[support] Forms in blocks
Iain William Wiseman
iwiseman at bibble.co.nz
Wed Oct 5 19:51:32 UTC 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20111006/2b7b1328/attachment-0001.html
More information about the support
mailing list