You are here

public function SearchApiDbService::getExtraInformation in Search API Database Search 7

Returns additional, service-specific information about this server.

If a service class implements this method and supports the "search_api_service_extra" option, this method will be used to add extra information to the server's "View" tab.

In the default theme implementation this data will be output in a table with two columns along with other, generic information about the server.

Return value

array An array of additional server information, with each piece of information being an associative array with the following keys:

  • label: The human-readable label for this data.
  • info: The information, as HTML.
  • status: (optional) The status associated with this information. One of "info", "ok", "warning" or "error". Defaults to "info".

Overrides SearchApiAbstractService::getExtraInformation

See also

supportsFeature()

File

./service.inc, line 199
Contains SearchApiDbService.

Class

SearchApiDbService
Indexes and searches items using the database.

Code

public function getExtraInformation() {

  // Set default settings.
  $options = $this->options + array(
    'min_chars' => 1,
    'partial_matches' => FALSE,
  );
  $info = array();
  $info[] = array(
    'label' => t('Database'),
    'info' => check_plain(str_replace(':', ' > ', $options['database'])),
  );
  if ($options['min_chars'] > 1) {
    $info[] = array(
      'label' => t('Minimum word length'),
      'info' => $options['min_chars'],
    );
  }
  $info[] = array(
    'label' => t('Search on parts of a word'),
    'info' => $options['partial_matches'] ? t('enabled') : t('disabled'),
  );
  if (!empty($options['autocomplete'])) {
    $options['autocomplete'] += array(
      'suggest_suffix' => TRUE,
      'suggest_words' => TRUE,
    );
    $autocomplete_modes = array();
    if ($options['autocomplete']['suggest_suffix']) {
      $autocomplete_modes[] = t('Suggest word endings');
    }
    if ($options['autocomplete']['suggest_words']) {
      $autocomplete_modes[] = t('Suggest additional words');
    }
    $autocomplete_modes = $autocomplete_modes ? implode('; ', $autocomplete_modes) : t('none');
    $info[] = array(
      'label' => t('Autocomplete suggestions'),
      'info' => $autocomplete_modes,
    );
  }
  return $info;
}