May a local city housing ordinance require developers to sell a portion of housing units at prices suitable for low- or moderate-income buyers?

A city enacts a housing ordinance requiring 15% of all new residential development projects with a minimum of 20 units be sold at prices suitable for low- or moderate-income buyers.