function panopoly_search_search_box_content_type_render in Panopoly Search 7
Render the custom content type.
File
- plugins/
content_types/ search_box/ search_box.inc, line 31 - Definition of the 'search form' panel content type
Code
function panopoly_search_search_box_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);
$block->content['basic']['keys']['#title'] = $conf['override_prompt'] ? $prompt : t('Enter your keywords');
if ($conf['form'] == 'simple' && isset($block->content['advanced'])) {
$block->content['advanced']['#access'] = FALSE;
}
return $block;
}