You are here

function hook_google_appliance_cluster_list_alter in Google Search Appliance 7

Same name and namespace in other branches
  1. 8 google_appliance.api.php \hook_google_appliance_cluster_list_alter()

Alter the cluster list render array containing related searches.

This hook is invoked after the list render array is constructed and just before it is passed to drupal_render().

Use this to alter the render array properties.

Parameters

$cluster_list: A renderable array conforming to theme_item_list().

$cluster_results: The raw cluster results returned via the Google Appliance instance.

See also

google_appliance_get_clusters()

theme_item_list()

Related topics

1 invocation of hook_google_appliance_cluster_list_alter()
google_appliance_get_clusters in ./google_appliance.module
get related search via the Google Search Appliance clustering service

File

./google_appliance.api.php, line 129
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

function hook_google_appliance_cluster_list_alter(&$cluster_list, $cluster_results) {

  // Add some CSS classes.
  $cluster_list['#attributes']['class'][] = 'foo-list';

  // Construct a new list of links using the raw results with a custom path.
  foreach ($cluster_results as $ind => $cluster) {
    $items[] = l($cluster['label'], 'search/my/path/' . $cluster['label']);
  }
  $cluster_list['#items'] = $items;

  // Change the first item of the list.
  $cluster_list['#items'][0] = '<span>A new item</span>';
}