-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a backport of recent changes from the 3 branch. Its provided as a minimal effort change so doesn't include tests, comments docs etc as CMSv4 is out of full support
- Loading branch information
Showing
5 changed files
with
109 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace SilverStripe\SearchService\Extensions; | ||
|
||
use SilverStripe\CMS\Model\SiteTree; | ||
use SilverStripe\Core\Extension; | ||
use SilverStripe\SearchService\DataObject\DataObjectDocument; | ||
|
||
class SiteTreeHierarchyExtension extends Extension | ||
{ | ||
|
||
public function updateSearchDependentDocuments(array &$dependentDocs): void | ||
{ | ||
if (!SiteTree::config()->get('enforce_strict_hierarchy')) { | ||
return; | ||
} | ||
|
||
$page = $this->getOwner(); | ||
|
||
foreach ($page->AllChildren() as $record) { | ||
$document = DataObjectDocument::create($record); | ||
$dependentDocs[$document->getIdentifier()] = $document; | ||
$dependentDocs = array_merge($dependentDocs, $document->getDependentDocuments()); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters