You are here

function apachesolr_panels_block in Apache Solr Panels 6.3

Same name and namespace in other branches
  1. 6 apachesolr_panels.module \apachesolr_panels_block()

Implementation of hook_block().

File

./apachesolr_panels.module, line 34
Integrates Apache Solr Search with Panels.

Code

function apachesolr_panels_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    $blocks[0]['info'] = t('Search form (Apache Solr Panels)');

    // Not worth caching.
    $blocks[0]['cache'] = BLOCK_NO_CACHE;
    return $blocks;
  }
  elseif ($op == 'configure') {
    $form['search_page'] = array(
      '#type' => 'textfield',
      '#title' => t('Path to search page'),
      '#default_value' => variable_get('apachesolr_panels_search_page', ''),
    );
    return $form;
  }
  elseif ($op == 'save') {
    variable_set('apachesolr_panels_search_page', $edit['search_page']);
  }
  elseif ($op == 'view' && user_access('search content')) {
    $block['content'] = drupal_get_form('apachesolr_panels_search_block');
    $block['subject'] = t('Search');
    return $block;
  }
}