You are here

protected function MessagePurgeOrchestrator::purgeMessagesByTemplate in Message 8

Find and purge messages according to template and purge settings.

Parameters

\Drupal\message\MessageTemplateInterface $message_template: The message template for which to retrieve message IDs.

array $purge_plugins: Array of purge plugin configurations, keyed by plugin ID.

1 call to MessagePurgeOrchestrator::purgeMessagesByTemplate()
MessagePurgeOrchestrator::purgeAllTemplateMessages in src/MessagePurgeOrchestrator.php
Purgers all messages for all templates as configured.

File

src/MessagePurgeOrchestrator.php, line 107

Class

MessagePurgeOrchestrator
Purges messages from the system based on global and template configurations.

Namespace

Drupal\message

Code

protected function purgeMessagesByTemplate(MessageTemplateInterface $message_template, array $purge_plugins) {
  foreach ($purge_plugins as $plugin_id => $configuration) {

    /** @var \Drupal\message\MessagePurgeInterface $plugin */
    $plugin = $this->purgeManager
      ->createInstance($plugin_id, $configuration);
    $message_ids = $plugin
      ->fetch($message_template);
    $plugin
      ->process($message_ids);
  }
}