You are here

function GlobalTemplateCollectionManager::getGlobalCollectionForLocalCollection in Courier 8

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

Get the global template collection associated with a local template collection.

Parameters

\Drupal\courier\TemplateCollectionInterface $template_collection: A local template collection entity.

Return value

\Drupal\courier\Entity\GlobalTemplateCollectionInterface|FALSE A global template collection entity, or FALSE if the template collection is not associated with a global template collection.

Overrides GlobalTemplateCollectionManagerInterface::getGlobalCollectionForLocalCollection

1 call to GlobalTemplateCollectionManager::getGlobalCollectionForLocalCollection()
GlobalTemplateCollectionManager::getGlobalCollectionForTemplate in src/Service/GlobalTemplateCollectionManager.php
Get the global template collection associated with a template.

File

src/Service/GlobalTemplateCollectionManager.php, line 59

Class

GlobalTemplateCollectionManager
The global template collection manager.

Namespace

Drupal\courier\Service

Code

function getGlobalCollectionForLocalCollection(TemplateCollectionInterface $template_collection) {
  $key = array_search($template_collection
    ->id(), $this->keyValueStore
    ->getAll(), TRUE);
  if ($key !== FALSE) {
    $gtc = GlobalTemplateCollection::load($key);
    if ($gtc) {
      return $gtc;
    }
  }
  return FALSE;
}