You are here

function mandrill_get_templates in Mandrill 7

Same name and namespace in other branches
  1. 8 mandrill.module \mandrill_get_templates()
  2. 7.2 mandrill.module \mandrill_get_templates()

Get a list of mandrill template objects.

Return value

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

1 call to mandrill_get_templates()
mandrill_template_map_form in modules/mandrill_template/mandrill_template.admin.inc
Return a form for adding/editing a Mandrill template map.

File

./mandrill.module, line 310
Enables Drupal to send email directly through Mandrill.

Code

function mandrill_get_templates() {

  // Only show the template settings if the mandrill api can be called.
  $templates = NULL;
  try {
    $mailer = mandrill_get_api_object();
    $templates = $mailer
      ->templates_list();
  } catch (MandrillException $e) {
    drupal_set_message(t('Mandrill: %message', array(
      '%message' => check_plain($e
        ->getMessage()),
    )), 'error');
    watchdog_exception('mandrill', $e);
  }
  return $templates;
}