You are here

public function GlobalTemplateCollectionManager::notifyTemplateChanged in Courier 2.x

Same name and namespace in other branches
  1. 8 src/Service/GlobalTemplateCollectionManager.php \Drupal\courier\Service\GlobalTemplateCollectionManager::notifyTemplateChanged()

Notify the manager that a template entity has been saved.

This method will resynchronise template contents with the global template collection configuration.

Parameters

\Drupal\courier\ChannelInterface $template: A template entity.

Overrides GlobalTemplateCollectionManagerInterface::notifyTemplateChanged

File

src/Service/GlobalTemplateCollectionManager.php, line 136

Class

GlobalTemplateCollectionManager
The global template collection manager.

Namespace

Drupal\courier\Service

Code

public function notifyTemplateChanged(ChannelInterface $template) {
  $gtc = $this
    ->getGlobalCollectionForTemplate($template);
  if ($gtc) {
    $contents = $template
      ->exportTemplate();
    $gtc
      ->setTemplate($template
      ->getEntityTypeId(), $contents);
    $gtc
      ->save();
  }
}