Planet Formation Theory in the Era of ALMA and Kepler: from Pebbles to Exoplanets