public function CourierManager::addTemplates in Courier 8
Same name and namespace in other branches
- 2.x src/Service/CourierManager.php \Drupal\courier\Service\CourierManager::addTemplates()
Adds all available channel types to the template collection.
Does not replace templates for existing channel types.
Parameters
\Drupal\courier\TemplateCollectionInterface $template_collection: A template collection entity.
Overrides CourierManagerInterface::addTemplates
File
- src/
Service/ CourierManager.php, line 78
Class
- CourierManager
- The courier manager.
Namespace
Drupal\courier\ServiceCode
public function addTemplates(TemplateCollectionInterface &$template_collection) {
foreach (array_keys($this->identityChannelManager
->getChannels()) as $entity_type_id) {
if (!$template_collection
->getTemplate($entity_type_id)) {
/** @var $template \Drupal\courier\ChannelInterface */
$template = $this->entityTypeManager
->getStorage($entity_type_id)
->create();
$template_collection
->setTemplate($template);
}
}
}