Commit a222ee29 authored by dpi's avatar dpi

Do not replace existing templates when adding all available channel types to a collection.

parent 35546164
...@@ -52,11 +52,13 @@ class CourierManager implements CourierManagerInterface { ...@@ -52,11 +52,13 @@ class CourierManager implements CourierManagerInterface {
*/ */
public function addTemplates(TemplateCollectionInterface &$template_collection) { public function addTemplates(TemplateCollectionInterface &$template_collection) {
foreach (array_keys($this->identityChannelManager->getChannels()) as $entity_type_id) { foreach (array_keys($this->identityChannelManager->getChannels()) as $entity_type_id) {
/** @var $template \Drupal\courier\ChannelInterface */ if (!$template_collection->getTemplate($entity_type_id)) {
$template = $this->entityManager /** @var $template \Drupal\courier\ChannelInterface */
->getStorage($entity_type_id) $template = $this->entityManager
->create(); ->getStorage($entity_type_id)
$template_collection->setTemplate($template); ->create();
$template_collection->setTemplate($template);
}
} }
} }
......
...@@ -20,6 +20,8 @@ interface CourierManagerInterface { ...@@ -20,6 +20,8 @@ interface CourierManagerInterface {
/** /**
* Adds all available channel types to the template collection. * Adds all available channel types to the template collection.
* *
* Does not replace templates for existing channel types.
*
* @param \Drupal\courier\TemplateCollectionInterface $template_collection * @param \Drupal\courier\TemplateCollectionInterface $template_collection
* A template collection entity. * A template collection entity.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment