You are here

function panopoly_search_search_current_content_type_render in Panopoly Search 7

Render the custom content type.

File

plugins/content_types/search_current/search_current.inc, line 28

Code

function panopoly_search_search_current_content_type_render($subtype, $conf, $panel_args, $context) {
  $keys = empty($context) || empty($context->data) ? '' : $context->data;
  $pane = new stdClass();
  $pane->module = 'search';
  $pane->delta = 'form';
  $pane->title = '';
  $pane->content = '';
  $searches = search_api_current_search();
  $count = NULL;
  if (isset($searches['search_api_views:panopoly_search:search_solr_results'])) {
    $count = $searches['search_api_views:panopoly_search:search_solr_results'][1]['result count'];
  }
  elseif (isset($searches['search_api_views:panopoly_database_search:search_database_results'])) {
    $count = $searches['search_api_views:panopoly_database_search:search_database_results'][1]['result count'];
  }
  if (!is_null($count)) {
    $pane->title = t('Search results: @count matched %keys', array(
      '@count' => format_plural($count, '1 item', '@count items'),
      '%keys' => $keys,
    ));
  }
  else {
    $pane->title = t('Search');
  }
  return $pane;
}