{ "startDate":"<?php print strftime('%Y,%m,%d', strtotime($event->field_date['und'][0]['value'])); ?>", "headline":"<?php print $event->title; ?>", "text":"<?php print str_replace(array("\r\n", "\n", "\r"), '<br>', str_replace('"', "'", $event->body['und'][0]['value'])); ?>", "asset": { <?php if (!empty($event->field_embed)) { ?> "media":"<?php print file_create_url($event->field_embed['und'][0]['uri']); ?>", "credit":"", "caption":"" <?php } else if (!empty($event->field_image)) { ?> "media":"<?php print file_create_url($event->field_image['und'][0]['uri']); ?>", "credit":"", "caption":"" <?php } else { ?> "media":"", "credit":"", "caption":"" <?php } ?> } }