You are here

public function MandrillAPI::getTemplates in Mandrill 8

Gets a list of mandrill template objects.

Return value

array An of available templates with complete data or NULL if none available.

Overrides MandrillAPIInterface::getTemplates

1 method overrides MandrillAPI::getTemplates()
MandrillTestAPI::getTemplates in src/MandrillTestAPI.php
Gets a list of mandrill template objects.

File

src/MandrillAPI.php, line 75

Class

MandrillAPI
Service class to integrate with Mandrill.

Namespace

Drupal\mandrill

Code

public function getTemplates() {
  $templates = NULL;
  try {
    if ($mandrill = $this
      ->getAPIObject()) {
      $templates = $mandrill->templates
        ->getList();
    }
  } catch (\Exception $e) {
    \Drupal::messenger()
      ->addError(t('Mandrill: %message', array(
      '%message' => $e
        ->getMessage(),
    )));
    $this->log
      ->error($e
      ->getMessage());
  }
  return $templates;
}