You are here

private function LazyForm::addLazyStatusMessage in Lazy-load 8.3

Add a informative message.

Parameters

array $links: The array of links.

string $type: Can be 'filters' or 'fields'.

\Drupal\Core\StringTranslation\TranslatableMarkup $message: The message.

1 call to LazyForm::addLazyStatusMessage()
LazyForm::getEnabledFiltersAndFields in src/Form/LazyForm.php
Builds the status report for all enabled filter formats & field formatters.

File

src/Form/LazyForm.php, line 203

Class

LazyForm
Configure Lazy settings for this site.

Namespace

Drupal\lazy\Form

Code

private function addLazyStatusMessage(array $links, string $type, TranslatableMarkup $message) : void {
  $links_result = 'none';
  $message_type = MessengerInterface::TYPE_WARNING;
  if (!empty($links[$type]) && count($links[$type])) {
    $links_result = [];
    foreach ($links[$type] as $link) {
      $links_result[] = Link::fromTextAndUrl($link['title'], $link['url'])
        ->toString();
    }
    $links_result = implode(', ', $links_result);
    $message_type = MessengerInterface::TYPE_STATUS;
  }
  $this
    ->messenger()
    ->addMessage(Markup::create($message . ' ' . $links_result), $message_type);
}