mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Made ContentController work properly if it doesn't have a dataRecord
MINOR phpDoc update for ContentController->getMenu() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64771 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
03830e1baa
commit
412df22527
@ -132,6 +132,7 @@ class ContentController extends Controller {
|
||||
|
||||
/**
|
||||
* Returns a fixed navigation menu of the given level.
|
||||
* @return DataObjectSet
|
||||
*/
|
||||
public function getMenu($level = 1) {
|
||||
if($level == 1) {
|
||||
@ -140,11 +141,14 @@ class ContentController extends Controller {
|
||||
} else {
|
||||
$parent = $this->data();
|
||||
$stack = array($parent);
|
||||
while($parent = $parent->Parent)
|
||||
array_unshift($stack, $parent);
|
||||
|
||||
if(isset($stack[$level-2]))
|
||||
$result = $stack[$level-2]->Children();
|
||||
if($parent) {
|
||||
while($parent = $parent->Parent) {
|
||||
array_unshift($stack, $parent);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($stack[$level-2])) $result = $stack[$level-2]->Children();
|
||||
}
|
||||
|
||||
$visible = array();
|
||||
@ -293,7 +297,7 @@ HTML;
|
||||
* Returns a page comment system
|
||||
*/
|
||||
function PageComments() {
|
||||
if($this->data()->ProvideComments) {
|
||||
if($this->data() && $this->data()->ProvideComments) {
|
||||
return new PageCommentInterface($this, 'PageComments', $this->data());
|
||||
} else {
|
||||
if(isset($_REQUEST['executeForm']) && $_REQUEST['executeForm'] == 'PageComments.PostCommentForm') {
|
||||
|
Loading…
Reference in New Issue
Block a user