public function classesToSearch($classes)
    {
        $supportedClasses = array(SiteTree::class, File::class);
        $illegalClasses = array_diff($classes, $supportedClasses);
        if ($illegalClasses) {
            throw new BadMethodCallException(
                "SearchForm::classesToSearch() passed illegal classes '" . implode("', '", $illegalClasses)
                . "'.  At this stage, only File and SiteTree are allowed"
            );
        }
        $legalClasses = array_intersect($classes, $supportedClasses);
        $this->classesToSearch = $legalClasses;
    }