You are here

function webform_panels_webform_panels_render in Webform Panels 7

Render callback for the content type plugin.

Renders the webform in the page using the selected view mode.

1 string reference to 'webform_panels_webform_panels_render'
webform_panels.inc in plugins/content_types/webform_panels.inc
Main file for the the webform content type definition.

File

plugins/content_types/webform_panels.inc, line 170
Main file for the the webform content type definition.

Code

function webform_panels_webform_panels_render($subtype, $conf, $panel_args, $context = NULL) {
  $block = new stdClass();
  $view_mode = $conf['view_mode'];

  // Add the rendered node in the selected view mode to the block.
  $node = node_load($conf['selected_forms']);

  // Check if user has access to the node being rendered.
  $access = node_access('view', $node);

  // If the user has access to these webforms, render them.
  if ($access) {
    $render = node_view($node, $view_mode);
    $block->content = render($render);
  }
  return $block;
}