You are here

function acquia_search_form_apachesolr_settings_alter in Acquia Search 6

Same name and namespace in other branches
  1. 6.3 acquia_search.module \acquia_search_form_apachesolr_settings_alter()

Implementation of hook_form_[form_id]_alter().

File

./acquia_search.module, line 106
Integration between Acquia Drupal and Acquia's hosted solr search service.

Code

function acquia_search_form_apachesolr_settings_alter(&$form, $form_state) {

  // Don't alter the form if there is no subscription.
  if (acquia_agent_subscription_is_active()) {
    $form['apachesolr_host'] = array(
      '#type' => 'item',
      '#title' => t("Search is being provided by the Acquia Search network service"),
      '#value' => variable_get('apachesolr_host', 'localhost'),
    );
    $form['apachesolr_port']['#type'] = 'value';
    $form['apachesolr_path']['#type'] = 'value';
    $form['apachesolr_failure']['#title'] = t("If your site cannot connect to the Acquia Search network service");
    $form['#submit'][] = 'acquia_search_settings_submit';
    $form['advanced']['acquia_search_edismax_default'] = array(
      '#type' => 'radios',
      '#title' => t('Allow advanced syntax for all searches'),
      '#default_value' => variable_get('acquia_search_edismax_default', 0),
      '#options' => array(
        0 => t('Disabled'),
        1 => t('Enabled'),
      ),
      '#description' => t('If enabled, all Acquia Search keyword searches may use advanced <a href="@url">Lucene syntax</a> such as wildcard searches, fuzzy searches, proximity searches, boolean operators and more via the Extended Dismax parser.', array(
        '@url' => 'http://lucene.apache.org/java/2_9_3/queryparsersyntax.html',
      )),
      '#weight' => 10,
    );
    $form['advanced']['acquia_search_request_timeout'] = array(
      '#type' => 'textfield',
      '#title' => t('Request timeout'),
      '#required' => TRUE,
      '#default_value' => variable_get('acquia_search_request_timeout', '20.0'),
      '#description' => t('A timeout in seconds that the entire request cannot exceeed. Usually this value will be significantly greater than the connection timeout.'),
      '#size' => 5,
      '#weight' => 15,
    );
    $form['advanced']['acquia_search_connect_timeout'] = array(
      '#type' => 'textfield',
      '#title' => t('Connection timeout'),
      '#required' => TRUE,
      '#default_value' => variable_get('acquia_search_connect_timeout', '3.0'),
      '#description' => t('A timeout in seconds that the connection alone cannot exceeed. It is usually safe to set this value is set between 1 and 5 seconds.'),
      '#size' => 5,
      '#weight' => 15,
    );
    $form['#validate'][] = 'acquia_search_settings_validate';
  }
}