You are here

public function GlobalTemplateCollectionManager::getGlobalCollectionForLocalCollection in Courier 2.x

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

Gets the global collection for a local collection.

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

public 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;
}