You are here

protected function MessageDigestTrait::getMessageDigestInterval in Message Digest 8

Returns the requested digest interval.

Parameters

string $id: The digest interval ID.

Return value

\Drupal\message_digest\Entity\MessageDigestIntervalInterface The digest interval entity.

File

src/Traits/MessageDigestTrait.php, line 201

Class

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

Namespace

Drupal\message_digest\Traits

Code

protected function getMessageDigestInterval($id) {
  try {

    /** @var \Drupal\message_digest\Entity\MessageDigestIntervalInterface $entity */
    $entity = \Drupal::entityTypeManager()
      ->getStorage('message_digest_interval')
      ->load($id);
    return $entity;
  } catch (InvalidPluginDefinitionException $e) {
    throw new \RuntimeException("Could not retrieve message digest interval '{$id}'.", 0, $e);
  }
}