You are here

function acquia_search_get_read_only_mode_warning in Acquia Connector 8

Same name and namespace in other branches
  1. 7.3 acquia_search/acquia_search.module \acquia_search_get_read_only_mode_warning()
  2. 7.2 acquia_search/acquia_search.module \acquia_search_get_read_only_mode_warning()

Returns formatted message about read-only mode.

Return value

\Drupal\Component\Render\MarkupInterface|string Renderable array or translatable markup.

2 calls to acquia_search_get_read_only_mode_warning()
acquia_search_requirements in acquia_search/acquia_search.install
Implements hook_requirements().
acquia_search_server_show_read_only_mode_warning in acquia_search/acquia_search.module
Generates DSM with read-only message warning.

File

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

Code

function acquia_search_get_read_only_mode_warning() {
  $msg = t('To protect your data, the Acquia Search module is enforcing
    read-only mode on the Search API indexes, because it could not figure out
    what Acquia-hosted Solr index to connect to. This helps you avoid writing to
    a production index if you copy your site to a development or other
    environment(s).');
  $core_service = acquia_search_get_core_service();
  if ($core_service
    ->getListOfPossibleCores()) {
    $item_list = [
      '#theme' => 'item_list',
      '#items' => $core_service
        ->getListOfPossibleCores(),
    ];
    $list = render($item_list);
    $msg .= '<p>';
    $msg .= t('The following Acquia Search Solr index IDs would have worked for your current environment, but could not be found on your Acquia subscription: @list', [
      '@list' => $list,
    ]);
    $msg .= '</p>';
  }
  $msg .= PHP_EOL . t('To fix this problem, please read <a href="@url">our documentation</a>.', [
    '@url' => 'https://docs.acquia.com/acquia-search/multiple-cores',
  ]);
  return Markup::create((string) $msg);
}