You are here

function mandrill_template_map_load_entities in Mandrill 8

Same name and namespace in other branches
  1. 7.2 modules/mandrill_template/mandrill_template.module \mandrill_template_map_load_entities()
  2. 7 modules/mandrill_template/mandrill_template.module \mandrill_template_map_load_entities()

Loads a single Mandrill Template Map, or all if no ID is provided.

Parameters

string $id: The ID of the Template Map to load.

Return value

array Array of Template Maps.

1 call to mandrill_template_map_load_entities()
mandrill_template_map_usage in modules/mandrill_template/mandrill_template.module
Get all mailsystem keys pointed at mandrill and their template mappings.

File

modules/mandrill_template/mandrill_template.module, line 17
Enables Drupal to send email using Mandrill's template system.

Code

function mandrill_template_map_load_entities($id = NULL) {
  $query = \Drupal::entityQuery('mandrill_template_map');
  if (!empty($id)) {
    $query
      ->condition('id', $id);
  }
  $map_ids = $query
    ->execute();
  $template_maps = \Drupal\mandrill_template\Entity\MandrillTemplateMap::loadMultiple($map_ids);
  return !empty($id) ? reset($template_maps) : $template_maps;
}