You are here

protected function MessageDigestTrait::getMessages in Message Digest 8

Returns the Message entities for the given IDs.

Parameters

int[] $message_ids: The message IDs.

Return value

\Drupal\message\MessageInterface[] The Message entities.

1 call to MessageDigestTrait::getMessages()
MessageDigestTrait::getUserMessagesByNotifier in src/Traits/MessageDigestTrait.php
Returns the messages that will be includes in the user's next digest.

File

src/Traits/MessageDigestTrait.php, line 143

Class

MessageDigestTrait
Methods useful for testing and integrating the Message Digest module.

Namespace

Drupal\message_digest\Traits

Code

protected function getMessages(array $message_ids) {
  $messages = [];
  try {
    $storage = \Drupal::entityTypeManager()
      ->getStorage('message');

    /** @var \Drupal\message\MessageInterface[] $messages */
    $messages = $storage
      ->loadMultiple($message_ids);
  } catch (InvalidPluginDefinitionException $e) {

    // If the 'message' entity type does not exist for some reason then there
    // are no messages.
  }
  return $messages;
}