From 50bab450299e237269e452ea6db1939d768fa4df Mon Sep 17 00:00:00 2001 From: Florian Thoma Date: Mon, 6 Feb 2023 11:45:51 +1100 Subject: [PATCH] add `onAfterPublishRecursive` hook fixes publication issue on pages when publish is clicked without saving first --- src/Extensions/SearchRecordExtension.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Extensions/SearchRecordExtension.php b/src/Extensions/SearchRecordExtension.php index a86e960..2265aa4 100644 --- a/src/Extensions/SearchRecordExtension.php +++ b/src/Extensions/SearchRecordExtension.php @@ -43,6 +43,16 @@ public function onAfterPublish() } } } + + public function onAfterPublishRecursive() + { + $engines = $this->getOwner()->getSearchEngines(); + if ($engines) { + foreach ($engines as $engine) { + $engine->publishEntry($this->getOwner()); + } + } + } public function onAfterDelete() { @@ -68,7 +78,7 @@ public function onAfterUnpublish() } } } - + public function getSearchEngines() { $classes = $this->getOwner()->getSearchEngineClasses();