function google_appliance_block in Google Search Appliance 6.2
Same name and namespace in other branches
- 5 google_appliance.module \google_appliance_block()
Implementation of hook_block().
File
- ./
google_appliance.module, line 500 - Google Search Appliance (GSA) / Google Mini integration
Code
function google_appliance_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$google_appliance_name = variable_get('google_appliance_name', GOOGLE_APPLIANCE_NAME_DEFAULT);
return array(
'google_search' => array(
'info' => t('@name Search', array(
'@name' => $google_appliance_name,
)),
'title' => t('Search'),
),
'recommended_links' => array(
'info' => t('Recommended Links'),
'title' => t('Recommended Links'),
'pages' => '*search/google_appliance*',
'visibility' => 1,
),
);
case 'view':
switch ($delta) {
case 'recommended_links':
if ($result =& google_appliance_static_response_cache()) {
$matches = $result
->getKeyMatches();
if (!$matches) {
return;
}
$links = array();
foreach ($matches as $link => $title) {
$links[] = l($title, $link);
}
if (count($links)) {
$block['content'] = theme('item_list', $links);
}
else {
return FALSE;
}
}
break;
case 'google_search':
$block['content'] = drupal_get_form('google_appliance_search_form', "");
$block['subject'] = t('Search');
return $block;
}
return $block;
break;
}
}