mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Merge pull request #111 from logicbrush/tagcloudfix
Uncaught Exception: Object->__call(): the method 'data' does not exist on 'Security'
This commit is contained in:
commit
067003a6c3
@ -50,21 +50,25 @@ class BlogTree extends Page {
|
||||
*/
|
||||
static function current($page = null) {
|
||||
|
||||
if (!$page) {
|
||||
if (!$page && Controller::has_curr()) {
|
||||
$controller = Controller::curr();
|
||||
if($controller) $page = $controller->data();
|
||||
if ($controller->hasMethod('data')) {
|
||||
$page = $controller->data();
|
||||
}
|
||||
}
|
||||
|
||||
// If we _are_ a BlogTree, use us
|
||||
if ($page instanceof BlogTree) return $page;
|
||||
if ($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;
|
||||
// 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();
|
||||
if($parent instanceof BlogTree) return $parent;
|
||||
// Or, if we a a BlogEntry underneath a BlogTree, use our parent
|
||||
if($page->is_a("BlogEntry")) {
|
||||
$parent = $page->getParent();
|
||||
if($parent instanceof BlogTree) return $parent;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to find a top-level BlogTree
|
||||
|
Loading…
Reference in New Issue
Block a user