In the last 10 years, driven a lot by school shootings, the tide shifted and parents started fighting schools about letting their kids keep their phone "so they can be contacted in emergencies". The schools gave up fighting with the parents.
Laws like this give the school cover to confiscate the phones and say "talk to your congressperson if this bothers you, my hands are tied".