function TemplateCollection::setTemplate in Courier 8
Same name and namespace in other branches
- 2.x src/Entity/TemplateCollection.php \Drupal\courier\Entity\TemplateCollection::setTemplate()
Sets a template for this collection.
Collections can accept one of each channel entity type.
Parameters
\Drupal\courier\ChannelInterface $template: A template entity.
Return value
\Drupal\courier\TemplateCollectionInterface Return this object for chaining.
Overrides TemplateCollectionInterface::setTemplate
File
- src/
Entity/ TemplateCollection.php, line 85
Class
- TemplateCollection
- Defines a local template collection entity.
Namespace
Drupal\courier\EntityCode
function setTemplate(ChannelInterface $template) {
// Remove any existing templates with the same channel.
$this
->removeTemplate($template
->getEntityTypeId());
// Replace this line after https://www.drupal.org/node/2473931 :
$this->templates[] = $template;
// $this->templates->appendItem($template);
return $this;
}