From 2a25b9459c89dbb84e4fa9b4765ceac3d4ea6d79 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Tue, 28 Jan 2014 12:24:31 +1300 Subject: [PATCH] FIX: resolve virtual page use with widgets. When using a VirtualPage mapping to a BlogTree, widgets will bypass the instanceof BlogTree check and instead fail to find the current page. --- code/BlogTree.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/BlogTree.php b/code/BlogTree.php index 60d534c..9d02bbb 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -57,6 +57,9 @@ class BlogTree extends Page { // If we _are_ a BlogTree, use us if ($page instanceof BlogTree) return $page; + // If page is a virtual page use that + if($page instanceof VirtualPage && $page->CopyContentFrom() instanceof BlogTree) return $page; + // Or, if we a a BlogEntry underneath a BlogTree, use our parent if($page->is_a("BlogEntry")) { $parent = $page->getParent();