You are here

function ctools_form_content_type_render in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 plugins/content_types/form/form.inc \ctools_form_content_type_render()

Output function for the 'node' content type. Outputs a node based on the module and delta supplied in the configuration.

File

plugins/content_types/form/form.inc, line 22

Code

function ctools_form_content_type_render($subtype, $conf, $panel_args, &$context) {
  $block = new stdClass();
  $block->module = 'form';
  if (isset($context->form)) {
    $block->title = $context->form_title;
    if (!empty($context->form_id)) {

      // If this is a form, drupal_render it.
      $block->content = drupal_render($context->form);
    }
    else {

      // Otherwise just spit back what we were given. This is probably an
      // error message or something.
      $block->content = $context->form;
    }
    $block->delta = $context->form_id;
  }
  else {
    $block->title = t('Form');
    $block->content = t('Form goes here.');
    $block->delta = 'unknown';
  }
  return $block;
}