You are here

function nodeformcols_nodeformcols_content_type_render in Node form columns 7

Output function for the 'nodeformcols' content type. Outputs a node form as displayed by the nodeformcols module.

File

plugins/content_types/nodeformcols.inc, line 29
Renders the nodeformcols form in a panel pane. The entire panel is inside the <form> tag. Most of the code is from the CTools form.inc content type.

Code

function nodeformcols_nodeformcols_content_type_render($subtype, $conf, $panel_args, &$context) {
  $block = new stdClass();
  $block->module = 'nodeformcols';
  $context->form['#theme'] = 'node_form';
  unset($context->form['#theme_used']);
  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;
}