/** * Renders attachments. Checks for error key and if present will display error using WriteErrorAttachment. * * @param array $Attachment Attachment * @return string */ function writeAttachment($Attachment) { $customMethod = AttachmentModel::GetWriteAttachmentMethodName($Attachment['Type']); if (function_exists($customMethod)) { if (val('Error', $Attachment)) { WriteErrorAttachment($Attachment); return; } $customMethod($Attachment); } else { trace($customMethod, 'Write Attachment method not found'); trace($Attachment, 'Attachment'); } return; }