You are here

function google_appliance_block_view in Google Search Appliance 7

Implements hook_block_view().

File

./google_appliance.module, line 165
Google Appliance module enables searching via a dedicated Google Search Appliance hardware device. See README.txt and the help page at admin/help/google_appliance.

Code

function google_appliance_block_view($delta = '') {
  $block = array();
  if (user_access('access_google_appliance_content')) {
    switch ($delta) {
      case 'ga_block_search_form':
        $block['content'] = drupal_get_form('google_appliance_block_form');
        break;
      case 'ga_related_searches':
        $block['subject'] = t('Related Searches');
        $block['content'] = google_appliance_get_clusters();

        // related search links
        break;
    }
    $results = drupal_static('google_appliance_parse_device_response_xml');
    if (isset($results['onebox'][$delta])) {
      $onebox = $results['onebox'][$delta];
      $subject = empty($onebox['url_text']) ? '' : $onebox['url_text'];
      $subject = empty($onebox['url_link']) ? $subject : l($subject, $onebox['url_link']);
      $block['subject'] = $subject;
      $block['content'] = array(
        '#theme' => 'google_appliance_onebox_module',
        '#onebox' => $onebox,
      );
    }
  }
  return $block;
}