A federal judge put a hold on the law hours before it was to take effect, saying there were legitimate questions about whether it violated the First Amendment.