You are here

function search_api_stats_block_block_configure in Search API Stats 7

Implements hook_block_configure().

File

contrib/search_api_stats_block/search_api_stats_block.module, line 43
search_api_stats_block.module

Code

function search_api_stats_block_block_configure($delta = '') {
  $form = array();
  $config = variable_get('search_api_stats_block_config', array());
  list($s_name, $i_name) = explode('__', $delta);
  if (!empty($s_name) && !empty($i_name)) {

    // Number of top search phrases to display
    $form['search_api_stats_block_num_phrases'] = array(
      '#type' => 'select',
      '#title' => t('Number of top search phrases to display'),
      '#default_value' => empty($config[$s_name][$i_name]['num_phrases']) ? 8 : $config[$s_name][$i_name]['num_phrases'],
      '#options' => drupal_map_assoc(array(
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10,
        11,
        12,
        13,
        14,
        15,
        16,
        17,
        18,
        19,
        20,
        25,
        30,
      )),
    );

    // Path of search page
    $form['search_api_stats_block_path'] = array(
      '#type' => 'textfield',
      '#title' => t('Path of search page'),
      '#default_value' => empty($config[$s_name][$i_name]['path']) ? '' : $config[$s_name][$i_name]['path'],
      '#required' => TRUE,
    );

    // Parameter name for the search phrase
    $form['search_api_stats_block_param_name'] = array(
      '#type' => 'textfield',
      '#title' => t('Parameter name for the search phrase'),
      '#default_value' => empty($config[$s_name][$i_name]['param_name']) ? 'keywords' : $config[$s_name][$i_name]['param_name'],
      '#required' => TRUE,
    );
  }
  return $form;
}