public static function TemplateCollection::getTemplateCollectionForTemplate in Courier 2.x
Same name and namespace in other branches
- 8 src/Entity/TemplateCollection.php \Drupal\courier\Entity\TemplateCollection::getTemplateCollectionForTemplate()
Locates the template collection which references a template.
Parameters
\Drupal\courier\ChannelInterface $template: A template entity.
Return value
\Drupal\courier\Entity\TemplateCollection|null A template collection entity, or NULL if the template is an orphan.
Overrides TemplateCollectionInterface::getTemplateCollectionForTemplate
3 calls to TemplateCollection::getTemplateCollectionForTemplate()
- courier_entity_predelete in ./
courier.module - Implements hook_entity_predelete().
- EmailForm::form in src/
Form/ EmailForm.php - Gets the actual form array to be built.
- GlobalTemplateCollectionManager::getGlobalCollectionForTemplate in src/
Service/ GlobalTemplateCollectionManager.php - Get the global template collection associated with a template.
File
- src/
Entity/ TemplateCollection.php, line 125
Class
- TemplateCollection
- Defines a local template collection entity.
Namespace
Drupal\courier\EntityCode
public static function getTemplateCollectionForTemplate(ChannelInterface $template) {
$ids = \Drupal::entityTypeManager()
->getStorage('courier_template_collection')
->getQuery()
->condition('templates.target_type', $template
->getEntityTypeId(), '=')
->condition('templates.target_id', $template
->id(), '=')
->execute();
return $ids ? static::load(reset($ids)) : NULL;
}