The school has a dress code. The kid's shirt did not violate it. This was an ad hoc I'm-offended-by-you decision.
The school wanted to send a political message they claimed would trump the 1st Amendment. They discovered the error and will pay for it.