You are here

function _mailchimp_campaign_build_merge_vars_html in Mailchimp 7.4

Same name and namespace in other branches
  1. 7.5 modules/mailchimp_campaign/includes/mailchimp_campaign.admin.inc \_mailchimp_campaign_build_merge_vars_html()
  2. 7.3 modules/mailchimp_campaign/includes/mailchimp_campaign.admin.inc \_mailchimp_campaign_build_merge_vars_html()

Builds a HTML string used to render merge vars on the campaign form.

Parameters

array $merge_vars: Array of merge vars. @see mailchimp_lists_get_merge_vars

Return value

string HTML string containing formatted merge vars.

1 call to _mailchimp_campaign_build_merge_vars_html()
mailchimp_campaign_get_merge_vars_form_elements in modules/mailchimp_campaign/includes/mailchimp_campaign.admin.inc
Gets form elements used in the merge vars feature.

File

modules/mailchimp_campaign/includes/mailchimp_campaign.admin.inc, line 570
Administration pages for mailchimp_campaign module.

Code

function _mailchimp_campaign_build_merge_vars_html($merge_vars) {
  if (!empty($merge_vars)) {
    $rows = array();
    foreach ($merge_vars as $var) {
      $rows[] = array(
        $var->name,
        '<a id="merge-var-' . $var->tag . '" class="add-merge-var" href="javascript:void(0);">*|' . $var->tag . '|*</a>',
      );
    }
    $table = theme('table', array(
      'rows' => $rows,
    ));
    return render($table);
  }
  else {
    return t('No custom merge vars exist for the current list.');
  }
}