You are here

function mailchimp_campaign_process_callback in Mailchimp 7.2

Same name and namespace in other branches
  1. 7.5 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_process_callback()
  2. 7.3 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_process_callback()
  3. 7.4 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_process_callback()

preg_replace_callback() callback for mailchimp_campaign_filter_campaign_process().

Parameters

array $matches:

Return value

string

1 string reference to 'mailchimp_campaign_process_callback'
mailchimp_campaign_filter_campaign_process in modules/mailchimp_campaign/mailchimp_campaign.module
Process callback for mailchimp_campaign_filter_info().

File

modules/mailchimp_campaign/mailchimp_campaign.module, line 442

Code

function mailchimp_campaign_process_callback($matches = array()) {
  $content = '';
  foreach ($matches as $key => $match) {
    switch ($key) {
      case 1:
        $entity_type = $match;
        break;
      case 2:
        $entity_id = $match;
        break;
      case 3:
        $view_mode = $match;
        break;
    }
  }
  $entities = entity_load($entity_type, array(
    $entity_id,
  ));
  if (!empty($entities)) {
    $render_array = entity_view($entity_type, $entities, $view_mode, NULL, TRUE);
    $content = render($render_array);
  }
  return $content;
}