Merge pull request #111 from logicbrush/tagcloudfix

Uncaught Exception: Object->__call(): the method 'data' does not exist on 'Security'
This commit is contained in:
Damian Mooyman 2014-03-22 23:49:11 +13:00
commit 067003a6c3

View File

@ -50,11 +50,14 @@ 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 ($page) {
// If we _are_ a BlogTree, use us
if ($page instanceof BlogTree) return $page;
@ -66,6 +69,7 @@ class BlogTree extends Page {
$parent = $page->getParent();
if($parent instanceof BlogTree) return $parent;
}
}
// Try to find a top-level BlogTree
$top = DataObject::get_one('BlogTree', "\"ParentID\" = '0'");