function 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 24

Code

function ctools_form_content_type_render($subtype, $conf, $panel_args, &$context) {
    $block = new stdClass();
    $block->module = 'form';
    if (isset($context->form)) {
        if (isset($context->form['#pre_render'])) {
            foreach ($context->form['#pre_render'] as $function) {
                if (function_exists($function)) {
                    $context->form = $function($context->form);
                }
            }
            unset($context->form['#pre_render']);
        }
        $block->title = $context->form_title;
        $block->content = array();
        foreach (element_children($context->form) as $element) {
            $block->content[$element] = $context->form[$element];
            unset($context->form[$element]);
        }
        $block->delta = $context->form_id;
    }
    else {
        $block->title = t('Form');
        $block->content = t('Form goes here.');
        $block->delta = 'unknown';
    }
    return $block;
}