You are here

public static function Messages::getSearchStatusMessage in Acquia Search 3.x

Returns formatted message about Acquia Search connection details.

Parameters

\Drupal\search_api\Entity\Server $server: Search server configuration entity.

Return value

\Drupal\Component\Render\MarkupInterface|string Formatted message about Acquia Search connection details.

Throws

\Drupal\Component\Plugin\Exception\PluginException

\Drupal\search_api\SearchApiException

3 calls to Messages::getSearchStatusMessage()
acquia_search_preprocess_search_api_index in ./acquia_search.module
Implements hook_preprocess_HOOK().
acquia_search_preprocess_search_api_server in ./acquia_search.module
Theme override function for Search API server status page.
acquia_search_requirements in ./acquia_search.install
Implements hook_requirements().

File

src/Helper/Messages.php, line 102

Class

Messages
Class Messages.

Namespace

Drupal\acquia_search\Helper

Code

public static function getSearchStatusMessage(Server $server) {

  /** @var \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend $backend */
  $backend = $server
    ->getBackend();
  $configuration = $backend
    ->getSolrConnector()
    ->getConfiguration();
  $items[] = Messages::getServerIdMessage($server
    ->id());
  if (Runtime::getPreferredSearchCoreService()
    ->isPreferredCoreAvailable()) {
    $items[] = Messages::getServerUrlMessage($configuration);

    // Report on the behavior chosen.
    if (isset($configuration['overridden_by_acquia_search'])) {
      $items[] = Messages::getOverriddenModeMessage($configuration['overridden_by_acquia_search']);
    }
    $items[] = Messages::getServerAvailabilityMessage($server);
    $items[] = Messages::getServerAuthCheckMessage($server);
  }
  else {
    $items[] = [
      '#markup' => '<span class="color-error">' . Messages::getNoPreferredCoreError() . '</span>',
    ];
  }
  $list = [
    '#theme' => 'item_list',
    '#items' => $items,
  ];
  $list = \Drupal::service('renderer')
    ->renderRoot($list);
  $msg = t('Connection managed by Acquia Search Solr module.') . $list;
  return Markup::create((string) $msg);
}