You are here

function apachesolr_facetcount_form in Apache Solr Search 6

Same name and namespace in other branches
  1. 5.2 apachesolr.module \apachesolr_facetcount_form()
  2. 5 apachesolr.module \apachesolr_facetcount_form()
  3. 6.2 apachesolr.module \apachesolr_facetcount_form()

Used by the 'configure' $op of hook_block so that modules can generically set facet limits on their blocks.

2 calls to apachesolr_facetcount_form()
apachesolr_og_block in contrib/apachesolr_og/apachesolr_og.module
Implementation of hook_block().
apachesolr_search_block in ./apachesolr_search.module
Implementation of hook_block().

File

./apachesolr.module, line 1153
Integration with the Apache Solr search application.

Code

function apachesolr_facetcount_form($module, $delta) {
  $initial = variable_get('apachesolr_facet_query_initial_limits', array());
  $limits = variable_get('apachesolr_facet_query_limits', array());
  $children = variable_get('apachesolr_facet_show_children', array());
  $facet_missing = variable_get('apachesolr_facet_missing', array());
  $limit = drupal_map_assoc(array(
    50,
    40,
    30,
    20,
    15,
    10,
    5,
    3,
  ));
  $form['apachesolr_facet_query_initial_limit'] = array(
    '#type' => 'select',
    '#title' => t('Initial filter links'),
    '#options' => $limit,
    '#description' => t('The initial number of filter links to show in this block.'),
    '#default_value' => isset($initial[$module][$delta]) ? $initial[$module][$delta] : variable_get('apachesolr_facet_query_initial_limit_default', 10),
  );
  $limit = drupal_map_assoc(array(
    100,
    75,
    50,
    40,
    30,
    20,
    15,
    10,
    5,
    3,
  ));
  $form['apachesolr_facet_query_limit'] = array(
    '#type' => 'select',
    '#title' => t('Maximum filter links'),
    '#options' => $limit,
    '#description' => t('The maximum number of filter links to show in this block.'),
    '#default_value' => isset($limits[$module][$delta]) ? $limits[$module][$delta] : variable_get('apachesolr_facet_query_limit_default', 20),
  );
  $form['apachesolr_facet_show_children'] = array(
    '#type' => 'radios',
    '#title' => t('Always show child facets'),
    '#options' => array(
      0 => t('No'),
      1 => t('Yes'),
    ),
    '#description' => t('Show the child facets even if the parent facet is not selected.'),
    '#default_value' => isset($children[$module][$delta]) ? $children[$module][$delta] : 0,
  );
  $form['apachesolr_facet_missing'] = array(
    '#type' => 'radios',
    '#title' => t('Include a facet for missing'),
    '#options' => array(
      0 => t('No'),
      1 => t('Yes'),
    ),
    '#description' => t('A facet can be generated corresponding to all documents entirely missing this field.'),
    '#default_value' => isset($facet_missing[$module][$delta]) ? $facet_missing[$module][$delta] : 0,
  );
  return $form;
}