You are here

function TemplateCollection::getTemplate in Courier 8

Same name and namespace in other branches
  1. 2.x src/Entity/TemplateCollection.php \Drupal\courier\Entity\TemplateCollection::getTemplate()

Get template with a channel entity type.

Parameters

string $channel_type_id: A channel entity type ID.

Return value

\Drupal\courier\ChannelInterface|NULL A message, or NULL.

Overrides TemplateCollectionInterface::getTemplate

File

src/Entity/TemplateCollection.php, line 66

Class

TemplateCollection
Defines a local template collection entity.

Namespace

Drupal\courier\Entity

Code

function getTemplate($channel_type_id) {
  foreach ($this
    ->getTemplates() as $template) {
    if ($template
      ->getEntityTypeId() == $channel_type_id) {
      return $template;
    }
  }
  return NULL;
}