You are here

function TemplateCollection::removeTemplate in Courier 8

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

Removes a template with the channel entity type.

Parameters

string $channel_type_id: A channel entity type ID.

Return value

\Drupal\courier\TemplateCollectionInterface Return this object for chaining.

Overrides TemplateCollectionInterface::removeTemplate

1 call to TemplateCollection::removeTemplate()
TemplateCollection::setTemplate in src/Entity/TemplateCollection.php
Sets a template for this collection.

File

src/Entity/TemplateCollection.php, line 97

Class

TemplateCollection
Defines a local template collection entity.

Namespace

Drupal\courier\Entity

Code

function removeTemplate($channel_type_id) {
  foreach ($this
    ->getTemplates() as $key => $template) {
    if ($channel_type_id == $template
      ->getEntityTypeId()) {
      $this->templates
        ->removeItem($key);
    }
  }
  return $this;
}