function ctools_search_form_content_type_render

Render the custom content type.

File

plugins/content_types/search/search_form.inc, line 33

Code

function ctools_search_form_content_type_render($subtype, $conf, $panel_args, $context) {
    if (empty($context) || empty($context->data)) {
        $keys = '';
    }
    else {
        $keys = $context->data;
    }
    // Build the content type block.
    $block = new stdClass();
    $block->module = 'search';
    $block->delta = 'form';
    $block->title = '';
    switch ($conf['path_type']) {
        default:
        case 'default':
            $path = 'search/' . $conf['type'];
            break;
        case 'same':
            $path = $_GET['q'];
            $path = str_replace($keys, '', $path);
            break;
        case 'custom':
            $path = $conf['path'];
            break;
    }
    $prompt = $conf['override_prompt'] ? $conf['prompt'] : NULL;
    $form_state = array(
        'build_info' => array(
            'args' => array(
                $path,
                $keys,
                $conf['type'],
                $prompt,
            ),
        ),
    );
    module_load_include('inc', 'search', 'search.pages');
    $block->content = drupal_build_form('search_form', $form_state);
    if ($conf['form'] == 'simple' && isset($block->content['advanced'])) {
        $block->content['advanced']['#access'] = FALSE;
    }
    return $block;
}