You are here

function _mailchimp_campaign_parse_template_content in Mailchimp 7.3

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

Parses template content to remove wrapper elements from tree.

Parameters

array $content: The template content array.

Return value

array The template content array minus wrapper elements.

2 calls to _mailchimp_campaign_parse_template_content()
mailchimp_campaign_campaign_form_submit in modules/mailchimp_campaign/includes/mailchimp_campaign.admin.inc
Submit handler for mailchimp_campaign_campaign_form().
mailchimp_campaign_campaign_preview in modules/mailchimp_campaign/includes/mailchimp_campaign.admin.inc
Preview callback for mailchimp_campaign_campaign_form().

File

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

Code

function _mailchimp_campaign_parse_template_content($content) {
  $template_content = array();
  $content_keys = array_keys($content);
  foreach ($content_keys as $content_key) {
    if (strpos($content_key, '_wrapper') !== FALSE) {

      // If this element is a wrapper, add the element contained
      // within the wrapper to the template content.
      $new_content_key = str_replace('_wrapper', '', $content_key);
      $template_content[$new_content_key] = $content[$content_key][$new_content_key];
    }
    else {

      // If this element is not a wrapper, add it to the template content.
      $template_content[$content_key] = $content[$content_key];
    }
  }
  return $template_content;
}