File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,7 @@ public function onBeforeDelete()
243243 $ firstVirtual = $ this ->getVirtualElements ()->First ();
244244 $ wasPublished = false ;
245245 }
246+
246247 if ($ firstVirtual ) {
247248 $ clone = $ this ->owner ->duplicate (false );
248249
@@ -251,9 +252,11 @@ public function onBeforeDelete()
251252 $ clone ->Sort = $ firstVirtual ->Sort ;
252253
253254 $ clone ->write ();
255+
254256 if ($ wasPublished ) {
255- $ clone ->doPublish ();
256- $ firstVirtual ->doUnpublish ();
257+ $ clone ->publishRecursive ();
258+
259+ $ firstVirtual ->doArchive ();
257260 }
258261
259262 // clone has a new ID, so need to repoint
@@ -262,14 +265,18 @@ public function onBeforeDelete()
262265 if ($ virtual ->ID == $ firstVirtual ->ID ) {
263266 continue ;
264267 }
268+
265269 $ pub = false ;
270+
266271 if ($ virtual ->isPublished ()) {
267272 $ pub = true ;
268273 }
274+
269275 $ virtual ->LinkedElementID = $ clone ->ID ;
270276 $ virtual ->write ();
277+
271278 if ($ pub ) {
272- $ virtual ->doPublish ();
279+ $ virtual ->publishRecursive ();
273280 }
274281 }
275282
You can’t perform that action at this time.
0 commit comments