mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
Merge branch '4.0' into 4
This commit is contained in:
commit
c954b6839b
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\FullTextSearch\Search\Variants;
|
namespace SilverStripe\FullTextSearch\Search\Variants;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
use SilverStripe\Assets\File;
|
use SilverStripe\Assets\File;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\FullTextSearch\Search\Indexes\SearchIndex;
|
use SilverStripe\FullTextSearch\Search\Indexes\SearchIndex;
|
||||||
@ -48,7 +49,7 @@ class SearchVariantSubsites extends SearchVariant
|
|||||||
|
|
||||||
public function currentState()
|
public function currentState()
|
||||||
{
|
{
|
||||||
return (string) SubsiteState::singleton()->getSubsiteId();
|
return SubsiteState::singleton()->getSubsiteId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reindexStates()
|
public function reindexStates()
|
||||||
@ -71,6 +72,12 @@ class SearchVariantSubsites extends SearchVariant
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_numeric($state)) {
|
||||||
|
$state = (int) $state;
|
||||||
|
} elseif ($state !== null) {
|
||||||
|
throw new InvalidArgumentException("Invalid state ID. State ID should be number or null.");
|
||||||
|
}
|
||||||
|
|
||||||
// Note: Setting directly to the SubsiteState because we don't want the subsite ID to be persisted
|
// Note: Setting directly to the SubsiteState because we don't want the subsite ID to be persisted
|
||||||
// like Subsite::changeSubsite would do.
|
// like Subsite::changeSubsite would do.
|
||||||
SubsiteState::singleton()->setSubsiteId($state);
|
SubsiteState::singleton()->setSubsiteId($state);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user