Rowling said it after the last book was published, but she told the HP film makers about it earlier when they suggested giving Dumbledore some sort of female romantic interest.
Reading between the lines of the last book, it’s not hard to pick up the gay subtext. It’s pretty much in the plotline.