You are here

function webform_block_block_view in Webform blocks 7

Implements hook_block_view().

File

./webform_block.module, line 17

Code

function webform_block_block_view($delta = '') {
  $node = menu_get_object();
  if (!isset($node->nid)) {
    return;
  }

  // We don't want to manipulate the actual node content. So we backup the
  // original content and insert it again once we're done. Why is the renderable
  // content stored as part of the node object in the first place?
  $original_content =& $node->content;
  unset($node->content);
  $node->content = array();
  webform_node_view($node, 'form');
  $block['subject'] = NULL;
  $block['content'] = isset($node->content['webform']) ? $node->content['webform'] : NULL;
  $node->content =& $original_content;
  return $block;
}