public function SearchApiAcquiaSearchService::configurationForm in Acquia Search for Search API 7
Same name and namespace in other branches
- 7.2 includes/SearchApiAcquiaSearchService.php \SearchApiAcquiaSearchService::configurationForm()
Overrides SearchApiSolrService::configurationForm().
Populates the Solr configs with Acquia Search Information.
Overrides SearchApiSolrService::configurationForm
File
- includes/
SearchApiAcquiaSearchService.php, line 94 - Contains SearchApiAcquiaSearchService.
Class
- SearchApiAcquiaSearchService
- Search API service class for Acquia Search.
Code
public function configurationForm(array $form, array &$form_state) {
$form = parent::configurationForm($form, $form_state);
// Set our special overrides if applicable
$this
->setConnectionOptions();
$options = $this->options += array(
'edismax' => 0,
'host' => $search_host,
'port' => '80',
'path' => variable_get('acquia_search_path', '/solr/' . $identifier),
'modify_acquia_connection' => FALSE,
'scheme' => 'http',
);
// HTTP authentication is not needed since Acquia Search uses an HMAC
// authentication mechanism.
$form['http']['#access'] = FALSE;
$form['edismax'] = array(
'#type' => 'checkbox',
'#title' => t('Always allow advanced syntax for Acquia Search'),
'#default_value' => $options['edismax'],
'#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. If not enabled, this syntax wll only be used when needed to enable wildcard searches.', array(
'@url' => 'http://lucene.apache.org/java/2_9_3/queryparsersyntax.html',
)),
'#weight' => -30,
);
$form['modify_acquia_connection'] = array(
'#type' => 'checkbox',
'#title' => 'Modify Acquia Search Connection Parameters',
'#default_value' => $options['modify_acquia_connection'],
'#description' => t('Only check this box if you are absolutely certain about what you are doing. Any misconfigurations will most likely break your site\'s connection to Acquia Search.'),
'#weight' => -20,
);
// Disable any port configuration option as Acquia will always be in
//control of those ports
$form['port']['#access'] = FALSE;
// Disable the http method that is selected as Acquia will always be https
// unless ACQUIA_DEVELOPMENT_NOSSL was set.
$form['scheme']['#access'] = FALSE;
$form['clean_ids_form']['#weight'] = 10;
// Re-sets defaults with Acquia information.
$form['host']['#default_value'] = $options['host'];
$form['path']['#default_value'] = $options['path'];
// Only display fields if we are modifying the connection parameters to the
// Acquia Search service.
$states = array(
'visible' => array(
':input[name="options[form][modify_acquia_connection]"]' => array(
'checked' => TRUE,
),
),
);
$form['host']['#states'] = $states;
$form['path']['#states'] = $states;
if ($this->options['scheme'] == 'https') {
$this->options['port'] = '443';
}
else {
$this->options['port'] = '80';
}
// We cannot connect directly to the Solr instance, so don't make it a link.
if (isset($form['server_description'])) {
$url = $this->options['scheme'] . '://' . $this->options['host'] . ':' . $this->options['port'] . $this->options['path'];
$form['server_description'] = array(
'#type' => 'item',
'#title' => t('Acquia Search URI'),
'#description' => check_plain($url),
'#weight' => -40,
);
}
return $form;
}