D8 Mailchimp - pierregermain/MyDrupal GitHub Wiki

Desde el template en mailchimp usar

 <div mc:edit="section_name">
 </div>

Ahi tenemos section_name para insertar contenido

Ahora, antes de llamar a mailchimp_campaign_save_campaign creamos asi el template necesario

// Save campaign and get campaign id as a return
$campaign = mailchimp_campaign_save_campaign($template, $recipients, $settings, $template_id, $campaign_id = NULL);

/**
 * Template is array of content sections 
 * $template = array(
 *   'section_name' => array(
 *     'value' => 'value',
 *     'format' => 'mailchimp_campaign',
 *   ),
 *  );
 *
 * Recipients like $recipients->list_id
 *
 * Settings is object of settings like
 * $settings = (object) array(
 *   'subject_line' => 'Subject',
 *   'title' => 'Title',
 *   'from_name' => 'From name',
 *   'reply_to' => 'Reply to',
 * );
 *
 * Template id is string e.g $template_id = 12345;
*/

El orden suele ser:

  • Crear render array
  • hacer save campaign $campaign_id = mailchimp_campaign_save_campaign($template_content, $recipients, $settings, $template_id, NULL);
  • guardarlo en drupal $campaign_id = $this->saveCampaign($newsletter, $template_id, $list_id, $subject, $title, $from_name, $reply_to, $type);
  • mandarlo con $campaign_send = $this->sendCampaign($campaign_id);
⚠️ **GitHub.com Fallback** ⚠️