The church part was literally just built inside of the mosque, while keeping virtually all of the architecture of the mosque around as part of the new church. Here you can see the mosque's architecture give way to the new construction: only the innermost part of the mosque was hollowed out to make way for the church.