File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -236,10 +236,20 @@ public function isChild($id)
236236 public function replaceChild ($ childId , AbstractNode $ newChild )
237237 {
238238 $ oldChild = $ this ->children [$ childId ];
239+ $ newChild ->prev = $ oldChild ['prev ' ];
240+ $ newChild ->next = $ oldChild ['next ' ];
239241 unset($ oldChild ['node ' ]);
240242 $ oldChild ['node ' ] = $ newChild ;
241243 unset($ this ->children [$ childId ]);
242244 $ this ->children [$ newChild ->id ()] = $ oldChild ;
245+
246+ if ($ newChild ->prev && isset ($ this ->children [$ newChild ->prev ])) {
247+ $ this ->children [$ newChild ->prev ]['next ' ] = $ newChild ->id ();
248+ }
249+
250+ if ($ newChild ->next && isset ($ this ->children [$ newChild ->next ])) {
251+ $ this ->children [$ newChild ->next ]['prev ' ] = $ newChild ->id ();
252+ }
243253 }
244254
245255 /**
You can’t perform that action at this time.
0 commit comments