You are here

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

Returns formatted message if preferred search core is unavailable.

Return value

string Formatted message.

3 calls to Messages::getNoPreferredCoreError()
acquia_search_requirements in ./acquia_search.install
Implements hook_requirements().
Messages::getSearchStatusMessage in src/Helper/Messages.php
Returns formatted message about Acquia Search connection details.
Messages::showNoPreferredCoreError in src/Helper/Messages.php
Generates DSM with "could not find preferred core" message warning.

File

src/Helper/Messages.php, line 45

Class

Messages
Class Messages.

Namespace

Drupal\acquia_search\Helper

Code

public static function getNoPreferredCoreError() : string {
  $possible_cores = Runtime::getPreferredSearchCoreService()
    ->getListOfPossibleCores();
  $messages[] = t('Could not find a Solr core corresponding to your website and environment.');
  if (!empty($possible_cores)) {
    $messages[] = t('These cores were expected but not found in your subscription: @list.', [
      '@list' => implode(', ', $possible_cores),
    ]);
  }
  $available_cores = Runtime::getPreferredSearchCoreService()
    ->getListOfAvailableCores();
  if (!empty($available_cores)) {
    $messages[] = t('Your subscription contains these cores: @list.', [
      '@list' => implode(', ', $available_cores),
    ]);
  }
  else {
    $messages[] = t('Your subscription contains no cores.');
  }
  $messages[] = t('To fix this problem, please read <a href="@url">our documentation</a>.', [
    '@url' => 'https://docs.acquia.com/acquia-search/multiple-cores/',
  ]);
  return implode(' ', $messages);
}