CRM-13179 wrap entire block in if clause to prevent empty div showing