ENHANCEMENT Add extension point to appliesTo for SearchVariantSubsites

This commit is contained in:
Scott Hutchinson 2019-08-05 16:17:49 +12:00
parent 2323b7f2cd
commit 9c9b2a3e20
2 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@ namespace SilverStripe\FullTextSearch\Search\Variants;
use ReflectionClass;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Extensible;
use SilverStripe\Core\Config\Configurable;
use SilverStripe\FullTextSearch\Search\Indexes\SearchIndex;
use SilverStripe\FullTextSearch\Search\Queries\SearchQuery;
@ -16,6 +17,7 @@ use SilverStripe\FullTextSearch\Utils\CombinationsArrayIterator;
abstract class SearchVariant
{
use Configurable;
use Extensible;
/**
* Whether this variant is enabled

View File

@ -36,10 +36,14 @@ class SearchVariantSubsites extends SearchVariant
// Include all DataExtensions that contain a SubsiteID.
// TODO: refactor subsites to inherit a common interface, so we can run introspection once only.
return SearchIntrospection::has_extension($class, SiteTreeSubsites::class, $includeSubclasses)
$appliesTo = SearchIntrospection::has_extension($class, SiteTreeSubsites::class, $includeSubclasses)
|| SearchIntrospection::has_extension($class, GroupSubsites::class, $includeSubclasses)
|| SearchIntrospection::has_extension($class, FileSubsites::class, $includeSubclasses)
|| SearchIntrospection::has_extension($class, SiteConfigSubsites::class, $includeSubclasses);
$this->extend('updateAppliesTo', $appliesTo, $class, $includeSubclasses);
return $appliesTo;
}
public function currentState()