You are here

public static function SendinblueManager::getTemplateList in SendinBlue 7

Same name and namespace in other branches
  1. 7.2 includes/sendinblue.manage.inc \SendinblueManager::getTemplateList()

Get template list.

Return value

array An array of template.

1 call to SendinblueManager::getTemplateList()
sendinblue_signup_form in includes/sendinblue_signup.admin.inc
Return a form for adding/editing a sendinblue signup form.

File

includes/sendinblue.manage.inc, line 385
Manage class file.

Class

SendinblueManager
Basic manager of module.

Code

public static function getTemplateList() {
  $access_key = variable_get(self::ACCESS_KEY, '');
  $mailin = new SendinblueMailin(self::API_URL, $access_key);
  $response = $mailin
    ->getCampaigns('template');
  $templates = array(
    array(
      'id' => '-1',
      'name' => 'Default',
    ),
  );
  if ($response['code'] == 'success' && is_array($response['data'])) {
    foreach ($response['data']['campaign_records'] as $template) {
      $templates[] = array(
        'id' => $template['id'],
        'name' => $template['campaign_name'],
      );
    }
  }
  return $templates;
}