You are here

function google_cse_block in Google Custom Search Engine 6

Same name and namespace in other branches
  1. 5 google_cse.module \google_cse_block()

Implementation of hook_block().

File

./google_cse.module, line 54
Display a Google Custom Search Engine on your site.

Code

function google_cse_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    return array(
      0 => array(
        'info' => t('Google CSE'),
        'cache' => BLOCK_NO_CACHE,
      ),
      1 => array(
        'info' => t('Google CSE results'),
        'cache' => BLOCK_NO_CACHE,
      ),
    );
  }
  elseif ($op == 'view' && user_access('search Google CSE')) {
    switch ($delta) {
      case 0:
        return array(
          'subject' => t('Search'),
          'content' => drupal_get_form('google_cse_searchbox_form'),
        );
      case 1:
        return array(
          'subject' => t('Search'),
          'content' => theme('google_cse_results', TRUE, TRUE),
        );
    }
  }
}